Skip to content Skip to sidebar Skip to footer

Create Powerpoint With Javascript

JavaScript cannot create files locally on the clients filesystem. However, I am wondering, if it is possible to somehow create a Powerpoint MIME in a web page (a div or a iframe) f

Solution 1:

One JavaScript library that can generate Powerpoint binary files is PptxGenJS.

Genreally speaking, you can create a link with a data URL that has a Powerpoint MIME type:

data:ms-powerpoint;base64,aGVsbG8gd... // base64-encoded file

Run your logic to create a binary Powerpoint file, then base64-encode it (e.g. with btoa), and then dynamically generate a link or redirect window.location to the data URI.

var binaryPPFile = createPowerpointFromJSON(sourceJSON);
window.location = "data:ms-powerpoint;base64," + btoa(binaryPPFile);

My hypothetical createPowerpointFromJSON function might make calls to the PptxGenJS API, or any other Powerpoint-generating API.

Post a Comment for "Create Powerpoint With Javascript"