PPTX
Generate native .pptx files from JSON and TypeScript.
Install
npm install @runstamp/pptx
Requires Node.js >=20. ESM only.
Quick Start
import {
PaperEngine,
compileDeclarativeDocument,
validate,
} from "@runstamp/pptx";
import { writeFileSync } from "node:fs";
const deck = {
title: "Quarterly Update",
slides: [
{
layout: "title",
title: "Quarterly Update",
subtitle: "Revenue grew 28% year over year.",
},
],
};
const validation = validate(deck);
if (!validation.ok) throw new Error(JSON.stringify(validation.issues));
const document = compileDeclarativeDocument(deck);
const buffer = await PaperEngine.render(document);
writeFileSync("deck.pptx", buffer);
Core API
validate(input)— returns{ ok, issues }with actionablepath,code,severity, andfixfields.compileDeclarativeDocument(input)— validates coordinate-free layouts and returns a renderablePaperDocument.PaperEngine.render(document, options?)— returns aUint8Arrayof the.pptxfile.
For layout fields and limits, see Declarative Authoring. The low-level PaperDocument AST remains available when an integration needs direct node control.
Additional exports include Zod schemas (PaperDocumentSchema, PaperSlideSchema, PaperNodeSchema), error classes (PaperError, RunstampFeatureError), typography helpers (loadFont, calculateTextMetrics, autoLoadDocumentFonts), and the lower-level runLayout for custom pipelines.
Deterministic Output
Hosted /api/v2/render and /api/v2/render-pack renders are deterministic by default: the same input produces byte-identical PPTX, DOCX, XLSX, or PDF output.
For local PPTX rendering, enable the package flag once at process startup:
import { setDeterministicMode } from "@runstamp/pptx";
setDeterministicMode(true);
The flag is process-global, so do not toggle it around concurrent requests. Server applications that need per-request control should use RenderContext with a DeterministicModeManager. For the other local SDKs, pass { deterministic: true } to renderToDocx, PdfEngine.render, or SpreadsheetEngine.render.
Hosted and commercial plans
Template round-tripping, HarfBuzz text shaping, advanced native charts, SmartArt handling, and canvas preview ship in @runstamp/pptx. Pro and higher plans add the managed API, durable jobs, brand packs, review controls, support, and commercial service terms; there is no separate PPTX npm engine to install. See License & Pricing.
In Next.js, import Runstamp only from Node.js Route Handlers or server code and declare export const runtime = "nodejs". Current packages pass stock Next.js 15 and 16 server builds without custom externalization. The Next.js integration guide retains a deployment-specific fallback for unsupported tracing environments.