PDFs

Turn HTML, Markdown or any URL into a print-ready PDF, rendered by Chrome: flexbox, grid and web fonts work. 1 credit per PDF.

GET | POST/v1/pdf
curl -X POST https://shotlane.dev/v1/pdf \
  -H "X-API-Key: $SHOTLANE_API_KEY" -H "Content-Type: application/json" \
  -d '{"html":"<h1>Invoice #42</h1><p>Total: $20</p>","paper":"Letter","page_numbers":true}' -o invoice.pdf

Every screenshot option works here too (url, html, markdown, wait_for_selector, cookies, css, hide_cookie_banners…), plus these:

Page setup

ParameterDefaultDescription
paperA4A0–A6, Letter, Legal, Tabloid, Ledger.
pdf_fit_one_pagefalsePut the whole page on one long PDF page instead of breaking it across sheets, e.g. for receipts or landing pages.
landscapefalseLandscape orientation.
pdf_width
pdf_height
—A custom page size instead of paper, e.g. 100mm × 150mm for labels.
margin0All four margins, e.g. 15mm, 1cm, 0.5in, 40px. Or set margin_top, margin_right, margin_bottom, margin_left.
pdf_scale1Content scale, 0.1–2.
page_ranges—Pages to keep, e.g. 1-3, 5.
print_backgroundtrueInclude background colors and images and use screen styles. false uses your @media print CSS.

Headers, footers and page numbers

ParameterDefaultDescription
page_numbersfalseA centered 1 / N footer.
header_template
footer_template
—HTML repeated on every page. Elements with the classes pageNumber, totalPages, date, title or url are filled in. Set font sizes inline; the default is tiny.
{"html": "…", "margin": "20mm",
 "footer_template": "<div style='font-size:9px;width:100%;text-align:right;padding:0 20mm'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></div>"}

Watermarks, passwords and metadata

ParameterDefaultDescription
watermark—Diagonal text on every page, e.g. DRAFT. watermark_opacity 0.03–1, default 0.15.
pdf_password—Password-protect the PDF (AES-256). Optional pdf_owner_password.
pdf_title
pdf_author
pdf_subject
pdf_keywords
—Document metadata shown by PDF readers and used by search.

Tips

  • Force a page break with break-before: page in your CSS; keep rows together with break-inside: avoid.
  • Load images and fonts from absolute https:// URLs, or inline them as data URIs.
  • An LLM-written report? Send it as markdown: tables, code blocks and lists get clean default styling.