Convert any webpage (or raw HTML) to a PDF with a single API call. SnapPDF renders the page in headless Chromium — CSS, web fonts, and backgrounds included — and returns the PDF bytes. No headless Chrome for you to run, scale, or patch.
HTML to PDF · URL to PDF · webpage to PDF · invoice/receipt PDF · save webpage as PDF
🔗 Live demo + docs: https://snappdf.dedyn.io:8444 ⚡ Get an API key (free tier): available on RapidAPI — see the demo page for the link.
Every call is GET /v1/pdf?url=<page> with your RapidAPI key. The response is application/pdf bytes.
Set RAPIDAPI_HOST to the exact host shown on your RapidAPI listing → Endpoints → Code Snippets (it looks like snappdf.p.rapidapi.com).
const fs = require("fs");
const HOST = "snappdf.p.rapidapi.com"; // copy the exact host from your listing
const url = "https://example.com";
const res = await fetch(`https://${HOST}/v1/pdf?format=A4&url=${encodeURIComponent(url)}`, {
headers: { "X-RapidAPI-Key": process.env.RAPIDAPI_KEY, "X-RapidAPI-Host": HOST },
});
fs.writeFileSync("out.pdf", Buffer.from(await res.arrayBuffer()));import os, requests, urllib.parse
HOST = "snappdf.p.rapidapi.com"
url = "https://example.com"
api = f"https://{HOST}/v1/pdf?format=A4&url=" + urllib.parse.quote(url)
r = requests.get(api, headers={"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST})
open("out.pdf", "wb").write(r.content)curl "https://snappdf.p.rapidapi.com/v1/pdf?url=https://example.com&format=A4" \
-H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
-H "X-RapidAPI-Host: snappdf.p.rapidapi.com" \
--output out.pdfMore runnable examples (PHP, Go, Ruby) are in examples/.
| Param | What it does |
|---|---|
url |
the http(s) page to render (required) |
format |
A4 (default), A3, A5, Letter, Legal, Tabloid |
landscape |
true for landscape orientation |
scale |
zoom factor 0.1–2 |
background |
false to omit CSS backgrounds |
wait_for_selector |
CSS selector to wait for before printing (for JS-rendered content) |
- Invoices & receipts — render your HTML invoice at a URL, get a print-ready PDF.
- Save / archive webpages as PDF at scale.
- Reports & dashboards exported to PDF on demand.
Does it run JavaScript on the page? Yes — it's real Chromium, so client-side JS runs before printing. Use wait_for_selector for content that loads after the initial render.
Do I have to run headless Chrome? No. That's the point — SnapPDF runs it for you; you make one HTTP request.
MIT licensed. Built by the SnapPDF team. Issues & PRs welcome.