Create JavaScript PowerPoint Presentations
npm install @hzhufa/pptxgenjsbash
npm install pptxgenjs --save
`
Yarn
`bash
yarn add pptxgenjs
`
CDN
jsDelivr Home
Bundle: Modern Browsers and IE11
`html
`
Min files: Modern Browsers
`html
`
Download
GitHub Latest Release
Bundle: Modern Browsers
- Use the bundle for IE11 support
`html
`
Min files: Modern Browsers
`html
`
Additional Builds
- CommonJS: dist/pptxgen.cjs.js
- ES Module: dist/pptxgen.es.js
---
Documentation
Quick Start Guide
PptxGenJS PowerPoint presentations are created via JavaScript by following 4 basic steps:
$3
`typescript
import pptxgen from "pptxgenjs";
// 1. Create a new Presentation
let pres = new pptxgen();
// 2. Add a Slide
let slide = pres.addSlide();
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);
// 4. Save the Presentation
pres.writeFile();
`
$3
`javascript
// 1. Create a new Presentation
let pres = new PptxGenJS();
// 2. Add a Slide
let slide = pres.addSlide();
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);
// 4. Save the Presentation
pres.writeFile();
`
That's really all there is to it!
---
Library API
Full documentation and code examples are available
- Creating a Presentation
- Presentation Options
- Adding a Slide
- Slide Options
- Saving a Presentation
- Master Slides
- Adding Charts
- Adding Images
- Adding Media
- Adding Shapes
- Adding Tables
- Adding Text
- Speaker Notes
- Using Scheme Colors
- Integration with Other Libraries
---
HTML-to-PowerPoint Feature
Easily convert HTML tables to PowerPoint presentations in a single call.
`javascript
let pptx = new PptxGenJS();
pptx.tableToSlides("tableElementId");
pptx.writeFile({ fileName: "html2pptx-demo.pptx" });
`
Learn more:
- HTML-to-PowerPoint Docs/Demo
---
Library Ports
React: react-pptx - thanks to Joonas!
---
Issues / Suggestions
Please file issues or suggestions on the issues page on github, or even better, submit a pull request. Feedback is always welcome!
When reporting issues, please include a code snippet or a link demonstrating the problem.
Here is a small jsFiddle that is already configured and uses the latest PptxGenJS code.
---
Need Help?
Sometimes implementing a new library can be a difficult task and the slightest mistake will keep something from working. We've all been there!
If you are having issues getting a presentation to generate, check out the code in the demos directory. There
are demos for both client browsers, node and react that contain working examples of every available library feature.
- Use a pre-configured jsFiddle to test with: PptxGenJS Fiddle
- View questions tagged PptxGenJS on StackOverflow. If you can't find your question, ask it yourself - be sure to tag it PptxGenJS`.