PowerPoint
.pptxrenderer for microscope-js. Reads the OOXML archive with JSZip, extracts the text runs from eachslide*.xml, and renders them as paginated slides. Lightweight text view — no full OOXML layout engine.
pnpm add @microscope-js/renderer-pptx
import { createRegistry, mount } from '@microscope-js/core';
import { pptxRenderer } from '@microscope-js/renderer-pptx';
const registry = createRegistry([pptxRenderer]);
const handle = await mount({ source: file, container, registry });
const cap = handle.capabilities as { slideCount: number; goToSlide(n: number): void };
console.log(cap.slideCount);
cap.goToSlide(3);
| Option | Default | Description |
|---|---|---|
maxBytes |
128 * 1024 * 1024 |
Reject .pptx files larger than this |
maxUncompressed |
512 * 1024 * 1024 |
Total uncompressed cap — zip-bomb defense |
RenderHandleinterface PptxHandle extends RenderHandle {
readonly capabilities: {
slideCount: number;
goToSlide(n: number): void;
};
}
Rendering OOXML pixel-perfect requires a complete shape + layout + font + image engine — usually ~2 MB of code and a long maintenance tail. This package goes the other way: it keeps the bundle tiny, leans on the browser for typography, and surfaces the content users actually want to read. If you need exact visual fidelity, pair this with a server-side preview pipeline (LibreOffice, OnlyOffice, etc.) for that one workflow.
Pixel-perfect rendering is on the roadmap as an opt-in package.
assertSafeZipEntry() before extraction — .. segments and absolute paths are rejected (CWE-22, zip-slip).ByteBudget caps total uncompressed bytes — defends against zip bombs (a 1 KB zip that expands to 4 GB).sanitizeHtml before being inserted.@microscope-js/renderer-docx · @microscope-js/renderer-xlsx@microscope-js/react — React adapter