pdf-to-pptx
PDF to PowerPoint
Turn a PDF into a deck, one slide per page, at the size the pages were.
- Reads
- a PDF — application/pdf
- Writes
- one file — slide decks
- Tool page
- /pdf-to-powerpoint
Example
Put a printed deck back into slides you can present from.
Given
- deck.pdf — an ordinary PDF of 3 pages
From code
import { loadDocument, runOperation } from '@pagecraft/core';
const deck = await loadDocument({ bytes, name: 'deck.pdf' });
const [output] = await runOperation('pdf-to-pptx', [deck], {
dpi: 150,
format: 'png',
});
From a shell
pagecraft pdf-to-pptx deck.pdf --dpi 150 --format png
What comes back
One slide deck.
This example is run by the test suite. If it stopped being true, the build would fail.
Options
dpi--dpi
integer (dpi)
Density
Pixels per inch each page is drawn at. 150 projects well; 300 is print quality.
Default: 150
format--format
string, one of
Format
Default: 'png'
png— Lossless, and much larger for a photograph.jpeg— Far smaller for scans and photographs.
quality--quality
integer (%)
Quality
How much detail to keep. Ignored by PNG, which discards nothing.
Default: 90
background--background
string, '#rrggbb'
Background
What shows through where the page draws nothing.
Default: '#ffffff'
pages--pages
string, a page selection: '1-3, 7, 9-', 'even', 'last'
Pages
Which pages become slides, and in what order: '1-3, 7, 9-'.
Default: 'all'
What it cannot do
- Each slide is a picture of a page. Nothing on it can be edited, selected, searched or read by a screen reader — this makes a PDF presentable, not editable.
- A deck has one slide size and a PDF need not have one page size. The first page settles it, and a page of a different shape is fitted inside and centred rather than stretched.
- A higher density makes a sharper slide and a much larger file: the deck holds one image per page, and doubling the density quadruples it.
- Links, form fields and annotations do not survive: they are not part of the picture of the page.