Guides
Server-side thumbnails with the CLI
Render every slide to SVG in Node, with no LibreOffice and no headless browser.
Goal
Thumbnails from a deck on a server, and a report of which fonts drew them.
You need
npm install @pptx-studio/cliSteps
1. From the command line
One file in, one SVG per slide out. --json prints the font report.
npx @pptx-studio/cli render deck.pptx --out slides/ --width 1280
npx @pptx-studio/cli render deck.pptx --slide 1 --width 640 --out thumb.svg --json2. From a program
renderDeck is the same renderer with bytes in and strings out.
import { renderDeck } from '@pptx-studio/cli';
const { slides, fonts, missing, facesIndexed } = renderDeck(bytes, { width: 1280 });
slides[0]?.svg; // stands alone: pictures as data: URIs
fonts.filter((face) => face.substituted); // what this machine could not draw as asked3. Fonts
The CLI indexes the machine's font files and measures from their tables. A container that ships no fonts substitutes everything, and fonts says so; give it faces with --font-dir.
npx @pptx-studio/cli render deck.pptx --font-dir ./fonts --out slides/4. The other verbs
The same packages, with a file argument and an exit code.
npx @pptx-studio/cli inspect deck.pptx # the census, as text or --json
npx @pptx-studio/cli validate deck.pptx # the 34 rules; exit 1 on anything fatal
npx @pptx-studio/cli roundtrip deck.pptx # read, write back, compare; --write saves it
npx @pptx-studio/cli bisect before.pptx after.pptx --oracle validateWhat can go wrong
CLI_NO_FACE- No font found at all; pass--font-diror install one.CLI_NO_SLIDE---slidenames a slide the deck does not have.CLI_WIDTH- The width is not a positive whole number.
Try it
Reading the deck…