PptxGenJS

Build PowerPoint presentations in JavaScript from Node.js, React, Electron, or the browser without needing PowerPoint installed.

Library
npm
v4.0.1
6,119stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
53/100Fair
Development Activity0
Maintenance32
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
68/100Good
Architecture78
Code Quality45
Innovation82
Learning Curve65

PptxGenJS is a JavaScript library for programmatically generating real PowerPoint (.pptx) files that open cleanly in Microsoft PowerPoint, Apple Keynote, and LibreOffice Impress. It works anywhere JavaScript runs — Node.js scripts, React/Angular/Vite applications, Electron desktop apps, web workers, and even vanilla browser pages — producing standards-compliant Open Office XML output through dual CJS/ESM builds plus a standalone browser bundle, with JSZip as its only runtime dependency.

The library exposes a slide-object API for building presentations from text, tables, images, shapes, charts, and embedded media, plus a dedicated HTML-to-PowerPoint path that converts an existing HTML <table> element into fully formatted slides with a single call. Full TypeScript definitions ship in the package for autocomplete and inline documentation, and output can be written as a saved file, base64 string, Blob, Node Buffer, or stream depending on the target environment.

What You Get

  • A full slide-object API (addText, addTable, addImage, addShape, addChart, addMedia) for building complete presentations programmatically
  • Dual ESM/CJS builds plus a standalone browser bundle, so the same library runs unmodified in Node, bundlers, and plain <script> tags
  • Built-in HTML-to-PowerPoint conversion via tableToSlides() for turning an existing HTML table into formatted slides
  • Complete TypeScript type definitions shipped in the package for autocomplete and inline documentation
  • Multiple output targets — write a file directly, or get base64, Blob, Buffer, or a Node stream

Common Use Cases

  • Generating branded reports or dashboards as downloadable .pptx files from a web app
  • Automating recurring slide decks (sales summaries, status updates, data reports) from a backend job
  • Exporting an existing HTML dashboard or table directly into PowerPoint for stakeholders who need an offline copy
  • Building presentation-authoring tools or templating systems on top of a scriptable slide API

Under The Hood

Architecture PptxGenJS is organized as a small set of flat TypeScript modules rather than a deep class hierarchy: pptxgen.ts defines the top-level PptxGenJS class that owns presentation-level state (layout, author/company metadata, slide list) and exposes the public addSlide/write/writeFile API; slide-level behavior is delegated to slide.ts’s Slide class, which itself delegates object construction to a set of generator modules (gen-objects.ts, gen-tables.ts, gen-charts.ts, gen-media.ts) that build internal object representations, and a separate gen-xml.ts module that serializes those representations into raw Open XML. core-interfaces.ts and core-enums.ts centralize shared types and constants consumed across all generator modules. This is a straightforward layered design — presentation to slide to object-generators to XML-serializer — with no dependency injection or plugin system; changing the OOXML output touches gen-xml.ts in isolation, but adding a new slide-object type touches its generator module, core-interfaces.ts, and gen-xml.ts together.

Tech Stack The library is written in TypeScript (over 95% of the codebase) and compiles via Rollup into dual CommonJS and ES Module builds plus a standalone browser bundle, with a package.json exports map so bundlers automatically pick the right format. The only runtime dependency is JSZip, used to assemble the .pptx as a zip-based OOXML package; Node-only modules like fs and https are stubbed out for browser builds. Build tooling mixes a legacy Gulp pipeline with the newer Rollup config, alongside ESLint 9 with typescript-eslint and a stylistic plugin for linting. There is no database, server framework, or ORM involved — this is a pure library codebase targeting Node, browsers, and bundlers uniformly.

Code Quality There is no automated unit-test suite in the repository — a dedicated testing guide documents a fully manual QA checklist (run demo scripts across Node, browser, web worker, Vite, and Webpack targets and visually confirm the output opens correctly in PowerPoint, Keynote, and Microsoft 365), and no CI workflow exists. Core modules are fully typed TypeScript with consistent naming conventions across generator and interface files, and ESLint enforces stylistic consistency, but there is limited evidence of automated checks beyond linting, and error handling is minimal — a handful of explicit thrown errors for invalid configuration, otherwise mostly console warnings for deprecated usage.

API Design The public API is deliberately small and consistent — create a presentation, add a slide, add objects to it, write the file — and a full presentation can be built in four lines, which the documentation leads with. Full TypeScript definitions give autocomplete and inline docs for every options object without needing to consult external references constantly. The standout capability is HTML-to-PowerPoint conversion, turning an existing HTML table into formatted slides in one call — a feature few comparable pure-JavaScript PowerPoint libraries offer. Multiple write targets let the same code adapt to Node, browser, or Electron without branching logic in user code.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search