PPTX
Generate native .pptx files from JSON and TypeScript.
Install
npm install @paperjsx/json-to-pptx
Requires Node.js >=20. ESM only.
Quick Start
import { PaperEngine } from "@paperjsx/json-to-pptx";
import { writeFileSync } from "node:fs";
const buffer = await PaperEngine.render({
type: "Document",
meta: { title: "Quarterly Update" },
slides: [
{
type: "Slide",
style: { padding: 40, backgroundColor: "#FFFFFF" },
children: [
{
type: "Text",
content: "Quarterly Update",
style: { fontSize: 28, fontWeight: "bold", color: "#1E293B" },
},
{
type: "Text",
content: "Revenue grew 28% year over year.",
style: { marginTop: 12, fontSize: 18, color: "#334155" },
},
],
},
],
});
writeFileSync("deck.pptx", buffer);
Core API
PaperEngine.render(document, options?)— returns aUint8Arrayof the.pptxfile.
Additional exports include Zod schemas (PaperDocumentSchema, PaperSlideSchema, PaperNodeSchema), error classes (PaperError, PaperJSXFeatureError), 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 "@paperjsx/json-to-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.
Pro
@paperjsx/json-to-pptx-pro adds templates, HarfBuzz text shaping, ChartEx, SmartArt, canvas preview, and production/self-hosted commercial rights.
npm install @paperjsx/json-to-pptx-pro
import { createEngine } from "@paperjsx/json-to-pptx-pro";
import { writeFileSync } from "node:fs";
const pptx = createEngine({
licenseKey: process.env.PAPERJSX_LICENSE_KEY,
});
const buffer = await pptx.render({
type: "Document",
meta: { title: "Board Review" },
slides: [
{
type: "Slide",
style: { padding: 40 },
children: [
{
type: "Text",
content: "Board Review",
style: { fontSize: 30, fontWeight: "bold", color: "#0F172A" },
},
{
type: "Text",
content: "ARR is up 41% year over year.",
style: { marginTop: 12, fontSize: 18, color: "#334155" },
},
],
},
],
});
writeFileSync("board-review.pptx", buffer);
Pro packages install directly from the public npm registry. Set PAPERJSX_LICENSE_KEY to the Ed25519-signed SDK license issued to your organization; never use a pj_live_… hosted API key here. See License & Pricing.
In Next.js, import PaperJSX 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.