JavaScript Library for PPTX Presentations

Open source free library to create & modify PowerPoint® PPTX in web apps.

What is PptxGenJS?

PptxGenJS is an open source JavaScript library with the ability to create PowerPoint PPTX presentations without any external dependencies. It can generate PPTX files with just a few simple JavaScript commands in any modern desktop and mobile browser and can also be integrated with Node, Angular, React, and Electron.

The PowerPoint JavaScript library supports features such as creating and modifying slides, adding charts, images, media files & shapes to slides, and inserting tables as well as text to slides. It also supports Master Slides for branding, SVG images, animated gifs, YouTube videos, RTL text, and Asian fonts. Another worth mentioning feature is the export of PPTX files directly to client browsers with proper MIME-type as well as in base64, blob & stream formats.

Previous Next

How to Install PptxGenJS?

Please use the following command to install using git.

Install PptxGenJS via git

<!-- Bundle: Easiest to use, supports all browsers -->
<script src="PptxGenJS/libs/pptxgen.bundle.js"></script>

Create PPTX Presentations via JavaScript

PptxGenJS library provides features for creating new PowerPoint PPTX presentations with a few lines of code inside web browsers or Node desktop apps. Once the presentation is created you can add a new slide to the presentation. It is also easy to add objects to the Slide such as charts, tables, shapes, images, etc.

Add Images & Charts to PPTX Slide

Images and charts bring great value to a presentation. Software programmers can easily add images and charts to a presentation Slide with the help of PptxGenJS API. There are several options available for image addition such as adding an image by local URL, image from a remote URL, image by data (pre-encoded base64) and Image with Hyperlink, etc. It also supports cropping and scaling an image.

Convert HTML to PowerPoint via JavaScript

The PptxGenJS library enables developers to convert HTML to PowerPoint PPTX Presentation while reproducing HTML tables into one or more slides. It also provides support for cell styling which includes background colors, padding, fonts, borders, etc.

The tableToSlides method clones the table including CSS style and creates slide. The following 3 lines of code can convert the HTML table to a PPTX slide.

  1. Instantiate PptxGenJS
  2. Call tableToSlides method with HTML element Id and rendering options
  3. Create PPTX file with the help of writeFile method

HTML to PPTX Conversion via JavaScript

let pptx = new PptxGenJS();
pptx.tableToSlides('htmlTableId', { x: 1.0, y: 1.0, w:10 });
pptx.writeFile({ fileName: 'table2slides.pptx' });