HTML to PDF API
Render any web page to a paginated PDF with Chromium, using your own print stylesheet.
Set format=pdf and the capture returns application/pdf bytes.
curl -G https://ssnap.cc/api/v1/screenshot \
-H "Authorization: Bearer $SSNAP_API_KEY" \
--data-urlencode "url=https://example.com/invoice/123" \
--data-urlencode "format=pdf" \
--data-urlencode "network_idle=true" \
--output invoice.pdfWhat changes in PDF mode
| Parameter | In PDF mode |
|---|---|
selector | Ignored; the document is always rendered whole. |
full_page | Not applicable; PDF output paginates the document. |
quality | Ignored; PDF is not a lossy raster format. |
background, border_*, watermark_* | Ignored; image post-processing is skipped for PDFs. |
theme | Applies. dark emulates prefers-color-scheme: dark. |
width / height, device_id | Apply; they set the rendering viewport, which drives responsive layout and CSS media queries. |
delay, network_idle | Apply. |
Watermarks and borders are image operations. If you need a watermark on a PDF, put it in
the page's own CSS (position: fixed works well with print styles) rather than in the
API call.
Print stylesheets
The page is rendered by Chromium, so its @media print rules apply. That is the place to
control page breaks, hide navigation, and set margins:
@media print {
nav, .cookie-banner { display: none; }
.invoice-section { break-inside: avoid; }
}Async for heavy documents
Long reports are the classic case for async callbacks: the render runs in the background with a 120-second job timeout, and your request returns at once.
curl -X POST https://ssnap.cc/api/v1/screenshot \
-H "Authorization: Bearer $SSNAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/reports/2026-q1",
"format": "pdf",
"network_idle": true,
"delay": 1500,
"callback_url": "https://your-app.com/hooks/ssnap"
}'Caching PDFs
cache_ttl works the same way for PDFs as for images, and a cache hit still skips the
quota charge. Since format is part of the cache key, a PDF and a PNG of the same page
are cached separately. See Screenshot caching.