developer api

SnapPDF is an HTML to PDF API: POST an HTML string or a URL to one Bearer-authenticated REST endpoint and get a pixel-accurate PDF back. Real SDKs in 5 languages — and a free tier that doesn't expire. Start free, then $4/mo when you ship.

quickstart · copy-paste
POST /api/v1/html-to-pdfcurl
curl -X POST https://snappdf.au/api/v1/html-to-pdf \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Invoice #1024</h1>"}' \
  --output invoice.pdf

Authenticate with a Bearer key (sk_live_* for production, sk_test_* for sandboxed tests). Base URL: https://snappdf.au/api/v1. HTML-to-PDF costs 5 credits per call.

render a live url instead

Snapshot a URL to PDF

Swap the html field for url and SnapPDF renders the live page — fonts, CSS and layout intact. URL-to-PDF is one endpoint, also 5 credits.

POST /api/v1/html-to-pdfcurl
curl -X POST https://snappdf.au/api/v1/html-to-pdf \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/report"}' \
  --output report.pdf
5 typed SDKs · one install line

Convert HTML to PDF in your language

Real, shipped SDKs in 5 languages — JavaScript/TypeScript, Python, PHP, Ruby and Go. No hand-rolled HTTP clients required.

JavaScript / TypeScript
npm i snappdf
import { SnapPDF } from "snappdf";

const snap = new SnapPDF({ apiKey: process.env.SNAPPDF_KEY });

const pdf = await snap.htmlToPdf({
  html: "<h1>Invoice #1024</h1>",
  format: "A4",
});

await pdf.writeTo("invoice.pdf");
Python
pip install snappdf
from snappdf import SnapPDF

snap = SnapPDF(api_key=os.environ["SNAPPDF_KEY"])

pdf = snap.html_to_pdf(
    html="<h1>Invoice #1024</h1>",
    format="A4",
)

pdf.write_to("invoice.pdf")
Go
go get github.com/seaqae/snappdf-go
client := snappdf.New(os.Getenv("SNAPPDF_KEY"))

pdf, err := client.HTMLToPDF(snappdf.HTMLToPDFRequest{
    HTML:   "<h1>Invoice #1024</h1>",
    Format: "A4",
})
if err != nil {
    log.Fatal(err)
}

os.WriteFile("invoice.pdf", pdf, 0644)

Also available: PHP (composer require snappdf/snappdf) and Ruby (gem install snappdf).

common options · same json body

Page size, margins, wait-for & more

Pass any of these six options alongside html or url in the request body to control the output.

formatstring

Page size — A4 (default), Letter, Legal, A3, A5 or Tabloid.

landscapeboolean

Rotate the page to landscape orientation. Defaults to false.

marginobject

Page margins as { top, right, bottom, left } — accepts px, mm, cm or in (e.g. "20mm").

printBackgroundboolean

Render CSS background colours and images. Defaults to true.

waitFornumber | string

Wait N milliseconds, or until a CSS selector appears, before snapshotting — for JS-rendered pages.

scalenumber

Zoom factor for the rendered page, 0.1–2.0. Defaults to 1.

how SnapPDF compares

SnapPDF vs PDFShift & DocRaptor

Five typed SDKs, a free tier that doesn't expire, and a $4 entry point — the three wedges most HTML-to-PDF APIs miss.

FeatureSnapPDFPDFShiftDocRaptor
HTML to PDFYes — HTML string or URLYesYes
Typed SDKs5 (JS/TS, Python, PHP, Ruby, Go)Community / unofficialPartial
Free tier100 credits/mo — never expires50 credits/mo7-day trial
Paid entry price$4/mo$9/mo$15/mo
Unlimited test keysYes — sandboxed, freeNoTest mode
pricing · usd

Start free, scale to $49/mo

Six tiers from $0 to $49/mo. The free tier's 100 monthly credits cover 20 HTML-to-PDF conversions every month, forever.

Free$0
forever

100 credits/mo · unlimited sandboxed test keys

Personal$4/mo
$29/yr

For side projects and small apps

Pro$8/mo
$57/yr

For production workloads

Business$24/mo
$172/yr

Higher volume, webhooks

Managed$49/mo
$349/yr

Managed support

EnterpriseCustom

Custom allowance + terms

faq

HTML to PDF API questions, answered

How do I convert HTML to PDF with an API?

+

Send a POST request to https://snappdf.au/api/v1/html-to-pdf with a Bearer API key and a JSON body of {"html":"<h1>Hi</h1>"} (or {"url":"https://..."}). The response is the rendered PDF. With a SnapPDF SDK it is a single function call — snap.htmlToPdf({ html }). HTML-to-PDF costs 5 credits per call.

Can I render a live URL to PDF instead of an HTML string?

+

Yes. Send {"url":"https://..."} instead of {"html":"..."} to the same /api/v1/html-to-pdf endpoint and SnapPDF snapshots the live page — fonts, CSS and layout intact. URL-to-PDF also costs 5 credits per call.

Is there a free HTML to PDF API?

+

Yes. SnapPDF gives 100 free credits every month that never expire, plus unlimited sandboxed test keys (sk_test_*) for development. HTML-to-PDF costs 5 credits, so the free tier covers 20 conversions a month with zero cost and no card required.

What options can I pass to control the PDF output?

+

You can set page size (format), orientation (landscape), margins, printBackground, scale, and waitFor — a delay in milliseconds or a CSS selector to wait for before snapshotting JS-rendered pages. All options are passed in the same JSON body as the html or url field.

Which languages have a SnapPDF SDK?

+

SnapPDF ships real, shipped SDKs in 5 languages: JavaScript/TypeScript (npm i snappdf), Python (pip install snappdf), PHP (composer require snappdf/snappdf), Ruby (gem install snappdf) and Go (go get github.com/seaqae/snappdf-go).

How much does HTML to PDF cost per call?

+

HTML-to-PDF and URL-to-PDF cost 5 credits each. Most other SnapPDF operations cost 1 credit; compress, rasterise and redact cost 2. Top-up packs never expire (1,000 credits = $10, 5,000 = $40, 25,000 = $150, 100,000 = $500).

Ship your first HTML to PDF in 5 minutes

100 free credits every month, forever. No card required to start.