Skip to content

Introduction ​

A .pptx file is a zip of XML parts. ts-pptx writes that zip: you describe slides in TypeScript, and the library produces the package. PowerPoint does not run and no Office licence is involved, so it works on a build server, in a serverless function or in a browser tab.

It works in three directions:

  • Write. Build a deck from code. This is what most of these docs cover.
  • Read and edit. Open a deck you already have, change it, save it. Parts you did not touch come out byte for byte as they went in. See Read and edit a deck.
  • Convert. Turn a deck into the TypeScript that would rebuild it, with a note for everything the conversion could not carry. See Deck to script.

When to reach for it ​

Use it when a deck is built from data that changes: a monthly report, one deck per customer, a nightly batch of hundreds, or a download button that hands someone a deck of what they are looking at.

It does not render slides. There is no export to PNG or PDF, and it never drives a PowerPoint installation. The demos page shows slides in the browser by handing the bytes to a separate renderer, pptx-html.

What you can build ​

AreaWhat you getGuide
TextParagraphs, runs with their own formatting, bullets, hyperlinksAPI reference
Text that fitsThe box shrinks or grows to its text, measured against the real font before the file is writtenText that fits
TablesCell styles, borders, merged cells, and tables that continue across as many slides as they needTables
HTML tablesAn existing <table> converted to slides, in a browser or under NodeHTML tables to slides
Shapes and connectorsPreset shapes, and lines that stay attached to the shapes they joinConnectors
GroupsObjects grouped, and groups nested inside groupsGroups
PicturesImages and SVGs, and a picture clipped to a shapeImages in shapes
Video and audioMedia embedded in the slideAPI reference
ChartsClassic types such as bar, line and pie, newer ones such as waterfall and treemap, each with its data in an embedded workbookAPI reference
Masters and layoutsSlide masters, layouts, sections and speaker notesAPI reference
Backgrounds and fillsSolid, gradient, pattern and picture fills on shapes, backgrounds, tables and chartsFills and gradients
Animations and transitionsEntrance, emphasis and exit effects, and slide transitionsAnimations and transitions
Embedded objectsA workbook or document that opens in place when double-clickedOLE embedded objects
3D modelsA .glb model that PowerPoint shows live3D models
MathLaTeX or MathML turned into native PowerPoint equationsMath equations
FontsFont files embedded in the deck, so it looks the same on a machine without themEmbedded fonts

What "works" means ​

The output opens cleanly in desktop PowerPoint, with no repair prompt. That is the bar every change is tested against. Keynote, LibreOffice Impress and Google Slides import the same files, on a best-effort basis: a difference that only shows up there is not treated as a defect when the file itself is valid.

Lineage ​

ts-pptx descends from PptxGenJS, detached at its v4.0.1 in June 2025, and is not a drop-in continuation of that release line. ts-pptx vs PptxGenJS measures what each library emits by building the same decks with both.

Limits to know up front ​

It needs Node.js 24 or later, and ships as one ESM build that Node, bundlers, browsers and require() all load. Two areas are outside what the maintainer actively develops. Reports there are welcome but tend to wait:

AreaSupportedNot actively developed
Browser layoutBuilding decks in a browser, and converting an HTML table under any DOMOutput that has to match how a browser laid a page out: measured widths, the resolved CSS cascade, the fonts a browser picked
Other office suitesFiles that open cleanly in desktop PowerPointBreakage that appears only after another application round-trips a file this library wrote correctly

The full statement is the scope page in the repository.

Next ​

See what the output looks like on the demos page, then install the package.