Skip to main content
Ssnap Docs
Guides

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.pdf

What changes in PDF mode

ParameterIn PDF mode
selectorIgnored; the document is always rendered whole.
full_pageNot applicable; PDF output paginates the document.
qualityIgnored; PDF is not a lossy raster format.
background, border_*, watermark_*Ignored; image post-processing is skipped for PDFs.
themeApplies. dark emulates prefers-color-scheme: dark.
width / height, device_idApply; they set the rendering viewport, which drives responsive layout and CSS media queries.
delay, network_idleApply.

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.

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.

Next