P. PDFHub
Blog / 11 Jun 2026 · 2 min read

HTML to PDF API — Generate Pixel-Perfect PDFs With One POST Request

Every SaaS eventually needs to generate PDFs — invoices, reports, receipts, certificates. And every team that tries the DIY route hits the same wall: PDF libraries that mangle CSS, headless browsers that eat server memory, font rendering that differs between dev and production.

The sane architecture: HTML in, PDF out

You already know how to build beautiful documents — with HTML and CSS. An HTML-to-PDF API lets you keep doing exactly that:

curl -X POST https://pdfhub.surf-api.com/api/v1/convert \
  -H "Authorization: Bearer ph_live_..." \
  -H "Content-Type: application/json" \
  -d '{"source": "<h1>Invoice #881</h1>", "filename": "invoice-881.pdf"}' \
  --output invoice-881.pdf

One POST request. The response body is the PDF.

Why rendering engine matters

PDFHub renders with real headless Chromium — the same engine as Chrome. CSS Grid, Flexbox, web fonts, SVG charts: if it looks right in your browser, it looks right in the PDF. Cheaper APIs built on wkhtmltopdf run a 2015-era engine where modern CSS quietly breaks.

You can also pass a URL instead of raw HTML, control page size (A4, Letter…), orientation, margins, and add a JS-rendering delay for SPA pages.

Pricing that doesn't punish growth

  • Free — 250 conversions/month, no card required
  • Starter — $9/mo for 5,000 (PDFShift charges $24 for half that)
  • Business — $29/mo for 25,000 · Scale — $99/mo for 100,000

Failed conversions never count against your quota. Get a key in 30 seconds at the dashboard, full reference at /developers.

Do it now — free

No signup, no watermark, files deleted after 24h.

Read the API docs

Keep reading

→ Add Page Numbers or a Watermark to a PDF (Free, Online) → 31 Free PDF & File Tools That Don't Make You Sign Up → Compress Images Online Free — Smaller JPG, PNG & WEBP