Node.js usage
Use Node.js 22 or later to convert and edit PPTX bytes without spawning an office process. File and storage operations remain explicit in your application.
Read and write files
import { readFile, writeFile } from "node:fs/promises";
import { createPptxEditorSession } from "pptx-glimpse";
const input = await readFile("input.pptx");
const editor = await createPptxEditorSession(input, {
skipSystemFonts: false,
});
await writeFile("edited.pptx", editor.save().pptx);Node.js Buffer is accepted because it is a subclass of Uint8Array. Public APIs remain byte-oriented and do not depend on Node.js file paths.
Resolve fonts
Set skipSystemFonts: false to let Node.js search known OS font directories. Use fontDirs to add application-owned directories, or supply fonts as bytes for the most portable setup.
import { readFile } from "node:fs/promises";
import { convertPptxToPng } from "pptx-glimpse";
const pptx = await readFile("input.pptx");
const report = await convertPptxToPng(pptx, {
skipSystemFonts: true,
fontDirs: ["/app/fonts"],
fontMapping: {
"Corporate Sans": "Inter",
},
});Keep output deterministic
System fonts vary across developer machines, CI runners, and production images. For stable output, bundle the exact font files you need, set skipSystemFonts: true, and use only explicit font bytes or directories.
Cache repeated work. For repeated slide renders, read the PPTX once with @pptx-glimpse/document and pass its source model to renderPptxSourceModelToSvg.
Containers and services
pptx-glimpse runs in the event loop and does not manage job queues, concurrency limits, or storage. Bound input size and concurrency at the application layer when processing untrusted presentations in a service.