PptxGenJS
JavaScript library that produces PowerPoint (pptx) presentations
Quickly and easily create PowerPoint presentations with a few simple JavaScript commands in client web browsers or Node desktop apps.
Main Features
- Widely Supported: Creates and downloads presentations on all current web browsers (Chrome, Edge, Firefox, etc.) and IE11
- Full Featured: Slides can include Charts, Images, Media, Shapes, Tables and Text (plus Master Slides/Templates)
- Easy To Use: Entire PowerPoint presentations can be created in a few lines of code
- Modern: Pure JavaScript solution - everything necessary to create PowerPoint PPT exports is included
Additional Features
- Use the unique HTML-to-PowerPoint feature to copy an HTML table into 1 or more Slides with a single command
Table of Contents (generated with DocToc)
- Live Demo
- Installation
- Quick Start Guide
- Library API
- HTML-to-PowerPoint Feature
- Integration with Other Libraries
- Full PowerPoint Shape Library
- Issues / Suggestions
- Need Help?
- Version 2.0 Breaking Changes
- Unimplemented Features
- Special Thanks
- Support Us
- License
Live Demo
Use JavaScript to Create a PowerPoint presentation with your web browser right now: https://gitbrent.github.io/PptxGenJS
Installation
Client-Side
Include Local Scripts
<script lang="javascript" src="PptxGenJS/libs/jquery.min.js"></script>
<script lang="javascript" src="PptxGenJS/libs/jszip.min.js"></script>
<script lang="javascript" src="PptxGenJS/dist/pptxgen.js"></script>
- IE11 support requires a Promises polyfill as well (included in the libs folder)
Include Bundled Script
<script lang="javascript" src="PptxGenJS/dist/pptxgen.bundle.js"></script>
- Bundle script includes all libraries: jQuery + JSzip + PptxGenJS + Promises
Install With Bower
bower install pptxgen
Node.js
npm install pptxgenjs
var pptx = require("pptxgenjs");
- Desktop: Compatible with Electron applications
Quick Start Guide
PptxGenJS PowerPoint presentations are created via JavaScript by following 4 basic steps:
- Create a new Presentation
- Add a Slide
- Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
- Save the Presentation
var pptx = new PptxGenJS();
var slide = pptx.addNewSlide();
slide.addText('Hello World!', { x:1.5, y:1.5, fontSize:18, color:'363636' });
pptx.save('Sample Presentation');
That's really all there is to it!
Library API
Presentation Creation/Options
Creating a Presentation Presentation Options
Slide Creation/Options
Saving a Presentation
Master Slides and Corporate Branding
Adding Charts
Adding Images
Adding Media (Audio/Video/YouTube)
Adding Shapes
Adding Tables
Adding Text
Including Speaker Notes
Using Scheme Colors
HTML-to-PowerPoint Feature
Integration with Other Libraries
Integration with Other Libraries
Full PowerPoint Shape Library
If you are planning on creating Shapes (basically anything other than Text, Tables or Rectangles), then you'll want to
include the pptxgen.shapes.js
library.
The shapes file contains a complete PowerPoint Shape object array thanks to the officegen project.
<script lang="javascript" src="PptxGenJS/dist/pptxgen.shapes.js"></script>
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 demos in the examples
directory. There
are demos for both Nodejs and client-browsers that contain working examples of every available library feature.
- Use a pre-configured jsFiddle to test with: PptxGenJS Fiddle
- Use Ask Question on StackOverflow - be sure to tag it with "PptxGenJS"
Version 2.0 Breaking Changes
Please note that version 2.0.0 enabled some much needed cleanup, but may break your previous code... (however, a quick search-and-replace will fix any issues).
While the changes may only impact cosmetic properties, it's recommended you test your solutions thoroughly before upgrading PptxGenJS to the 2.0 version.
All Users
The library getVersion()
method is now a property: version
Option names are now caseCase across all methods:
font_face
renamed tofontFace
font_size
renamed tofontSize
line_dash
renamed tolineDash
line_head
renamed tolineHead
line_size
renamed tolineSize
line_tail
renamed tolineTail
Options deprecated in early 1.0 versions (hopefully nobody still uses these):
marginPt
renamed tomargin
Node Users
Major Change
require('pptxgenjs')
no longer returns a singleton instancepptx = new PptxGenJS()
will create a single, unique instance- Advantage: Creating multiple presentations is much easier now - see Issue #83 for more).
Unimplemented Features
The PptxGenJS library is not designed to replicate all the functionality of PowerPoint, meaning several features are not on the development roadmap.
These include:
- Animations
- Importing Existing Presentations and/or Templates
- Outlines
- SmartArt
Special Thanks
- Officegen Project - For the Shape definitions and XML code
- Dzmitry Dulko - For getting the project published on NPM
- kajda90 - For the new Master Slide Layouts
- PPTX Chart Experts: kajda90, Matt King, Mike Wilcox
- Everyone who has submitted an Issue or Pull Request. :-)
Support Us
Do you like this library and find it useful? Tell the world about us! PptxGenJS project
Thanks to everyone who supports this project! <3
License
Copyright © 2015-2018 Brent Ely