For AI agents: a documentation index is available at /llms.txt
Skip to main content

Export a Slide Deck to PDF or PNG

Export a slide presentation to PDF or PNG by locking the viewport to the slide's aspect ratio and forcing screen media so backgrounds and fonts render as intended.

Prerequisites
Why emulateMedia: screen?

PDF generation defaults to print media, which strips background colors, changes fonts, and removes visual styling that slide decks rely on. Setting media to screen captures the presentation exactly as it appears in a browser.

Steps

Send a POST to the /pdf endpoint with screen media emulation and a 16:9 viewport. The viewport dimensions (1280×720) match the standard slide aspect ratio so each page in the PDF maps to exactly one slide.

View Full Code on GitHub

1. Build the request

Append your token to the PDF endpoint:

https://production-sfo.browserless.io/pdf?token=YOUR_API_TOKEN_HERE

2. Send the request

curl -X POST \
"https://production-sfo.browserless.io/pdf?token=YOUR_API_TOKEN_HERE" \
-H "Cache-Control: no-cache" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/my-presentation",
"emulateMedia": "screen",
"viewport": { "width": 1280, "height": 720 },
"options": {
"printBackground": true,
"width": "1280px",
"height": "720px"
}
}' \
-o slides.pdf

3. Check the output

The response body is a raw PDF binary written to slides.pdf. Each page is 1280×720px, one slide per page.

Exporting to PNG

Replace the endpoint with /screenshot and remove the options field to capture the first slide as a PNG instead:

curl -X POST \
"https://production-sfo.browserless.io/screenshot?token=YOUR_API_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/my-presentation",
"emulateMedia": "screen",
"viewport": { "width": 1280, "height": 720 },
"options": { "type": "png" }
}' \
-o slide-1.png

Next steps