Guides / PDF exports
PDF exports
PDF is the right format when people need to print, archive, or e-sign. ScreenNabster uses the browser's print pipeline so CSS @media print rules apply the same way they would for a visitor choosing “Print to PDF.”
Overview
Request output: "pdf". The worker loads your URL or HTML, applies viewport and interaction options, then emits a binary PDF stream back through the gateway. Large documents may take longer than a PNG—plan timeouts accordingly or switch to background jobs.
Minimal example
curl -X POST "https://screennabster.com/api/v1/capture" \
-H "X-API-Key: pk_live_…" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://example.com/invoice\",\"output\":\"pdf\"}" \
--output invoice.pdfPaper size & orientation
pdf_format accepts A0 through A6, Letter, Legal, or Tabloid; A4 is the default. Set pdf_landscape: true when charts or tables need horizontal room.
{
"url": "https://example.com/report",
"output": "pdf",
"pdf_format": "Letter",
"pdf_landscape": true
}Media mode & one-page fit
PDFs default to print media so pages honor @media print styles. Set media_type: "screen" when the PDF should match the on-screen layout instead. For long receipts, dashboards, or generated reports that must stay on one sheet, pdf_fit_one_page: true sizes the PDF page to the rendered document dimensions.
{
"url": "https://example.com/dashboard",
"output": "pdf",
"media_type": "screen",
"pdf_fit_one_page": true
}Margins & scale
Provide pdf_margin as a CSS shorthand (e.g. "1in") or set individual sides with pdf_margin_top, pdf_margin_right, pdf_margin_bottom, pdf_margin_left. Use pdf_scale between 0.1 and 2 to shrink or enlarge content when the default print density is too large for archival policies.
Background graphics
By default pdf_print_background: true keeps gradients and hero images. Set it to false for ink-saving documents where only text matters.
When PDF beats PNG
- Text stays selectable and searchable inside the file.
- Multi-page articles become one artifact instead of a huge bitmap.
- Branded templates with print CSS can omit chrome you do not want in screenshots.
When you need pixel-perfect marketing thumbnails, PNG or WebP from the viewport guide is usually simpler.