Skip to Content

Rendering presentations

Render complete presentations or selected slides as embeddable SVG or PNG bytes. The conversion report also describes unsupported and fallback content.

Choose SVG or PNG

convertPptxToSvg

Best for browser previews, thumbnails, selectable text, and responsive interfaces.

convertPptxToPng

Best for image pipelines, exports, vision models, and fixed raster output.

import { convertPptxToSvg } from "pptx-glimpse";

const { slides } = await convertPptxToSvg(pptx, {
  slides: [1, 3],
  textOutput: "text",
});

const firstSlideSvg = slides[0]?.svg;

SVG is active document markup. Before inserting SVG from an untrusted presentation into the DOM, apply an SVG-aware sanitizer and a restrictive Content Security Policy. See the browser runtime guide for details.

Conversion options

slides
One-based slide numbers to render. Omit it to render the complete deck.
width
PNG output width in pixels. The default is 960.
fonts
Font bytes supplied by the application. This is the portable browser option.
fontDirs
Directories scanned for fonts in Node.js environments.
skipSystemFonts
Prevents scanning OS font directories for deterministic or browser-safe output.
fontMapping
Maps presentation font names to fonts available in the rendering environment.

Fonts and text output

SVG defaults to path output for predictable rendering. Set textOutput: "text" to emit native SVG text with embedded subset fonts. Native text is selectable and often smaller for CJK-heavy slides, but the viewing environment can affect its rasterization. PNG always uses paths. convertPptxToPng ignores SVG text mode and converts text to paths before rasterization.

Reports and diagnostics

const { slides, diagnostics, supportCoverage } =
  await convertPptxToSvg(pptx);

for (const diagnostic of diagnostics) {
  console.warn(diagnostic.code, diagnostic.message);
}

console.log(supportCoverage.overall);

Support coverage counts input, output, skipped, unresolved, and fallback elements. It is not a pixel-accuracy score or a promise that PowerPoint would render the slide identically.