Create Powerpoint with JavaScript

我是研究僧i 提交于 2019-12-03 11:44:14

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!