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 A4 (default), A3, Letter, Legal, or Tabloid. Set pdf_landscape: true when charts or tables need horizontal room.
{
"url": "https://example.com/report",
"output": "pdf",
"pdf_format": "Letter",
"pdf_landscape": 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.