HTML2PDF
HTML in. Pixel-perfect PDF out.
One API call that renders your HTML and CSS into a print-ready PDF — invoices, statements, contracts, reports — exactly as a browser would. Real vector text, full modern CSS, headers and page numbers.
Coming to POST https://api.blueport.io/v1/html2pdf — renders typically finish in 2–5 seconds.
Three steps. One of them is yours.
You send the HTML. A real browser engine does the rendering. You get back a PDF that looks exactly like your page.
Post your HTML
Send inline HTML and CSS (or a URL) with your organisation's API key — merge fields welcome. That's the whole integration.
A real browser renders it
Headless Chrome, not a converter — full modern CSS, grid and flexbox, your web fonts, your exact brand.
The PDF streams back
Print-ready A4, Letter or custom sizes with headers, footers and page numbers — typically in 2–5 seconds.
One template, seen both ways
On the left, the HTML template your team already knows how to write. On the right, the PDF your customer receives — same layout, same fonts, same brand.
Template — POST /html2pdf
<style> .inv { font: 13px Inter; color: #112A50; } .tot { border-top: 2px solid #0A1931; font-weight: 800; } </style> <div class="inv"> <h1>{{supplier.name}}</h1> <p>ABN {{supplier.abn}}</p> <h2>Tax invoice {{invoice.number}}</h2> <p>Bill to: {{customer.name}}</p> <table> {{#each lineItems}} <tr><td>{{description}}</td> <td>{{amount}}</td></tr> {{/each}} </table> <p class="tot">Total AUD {{totals.total}}</p> <footer>Page {{page}} of {{pages}}</footer> </div>
The rendered PDF
Coastline Powersports Pty Ltd
14 Slipway Drive, Marlin Bay NSW 2430
accounts@coastlineps.example
| Description | Qty | Unit | Amount |
|---|---|---|---|
| 30,000 km service — labour | 1 | 289.00 | 289.00 |
| Oil filter HF-204 | 1 | 24.50 | 24.50 |
| Engine oil 10W-40 (3.2 L) | 1 | 58.80 | 58.80 |
| Brake pads — front set | 1 | 89.95 | 89.95 |
Start simple, graduate without rewriting
One endpoint, three input shapes. Moving from inline templates to stored ones is a one-field change — swap html for template_id and nothing else moves.
Static HTML
Post the markup raw with content-type: text/html — the PDF streams straight back. Perfect for pages you already generate.
Template + data, inline
Send { html, data } — Handlebars fields, loops and conditionals merge in the same call. Ideal for prototyping.
Stored template + data
Store the template once, versioned server-side — then every render is just { template_id, data }. Free previews before you go live.
Prints like a browser, because it is one
Most PDF converters re-implement a slice of CSS and hope. HTML2PDF runs your markup through a real browser engine, so what you preview is what you ship.
Typical PDF converter
- Partial CSS — flexbox and grid layouts quietly collapse
- System fonts only; your brand type is substituted
- Headers, footers and page numbers are an add-on syntax to learn
- Rasterised output — blurry text, huge files, nothing selectable
- Every template needs converter-specific workarounds
HTML2PDF
- Full modern CSS — grid, flexbox, custom properties, print styles
- Your web fonts, embedded and licensed as you serve them
- Headers, footers and page numbers in plain HTML
- True vector text — crisp at any zoom, selectable, small files
- If it renders in Chrome, it renders in your PDF
Your brand, down to the pixel
If your team can build a web page, they can build your documents — no proprietary template language to learn.
Full modern CSS
Grid, flexbox, custom properties, print styles — a real browser engine renders exactly what your markup says.
Merge data in
Post a template with mustache-style fields and a JSON payload in the same call — one request per finished document.
Headers & page numbers
Running headers, footers and "Page 2 of 7" in plain HTML — the paperwork details that converters make painful.
Any paper size
A4, Letter, custom dimensions, margins and orientation per request — print-ready without a print dialog.
Fast and synchronous
Typical renders finish in 2–5 seconds and stream straight back — no job queues, no polling, no webhooks.
Private by design
Templates and data are processed in flight and never stored — only usage counts and timings are recorded.
Simple plans, priced per render
No credit systems to decode — a render is one finished PDF. Every plan lands under 0.7¢ a render, with the same simple key and dashboard as PDF2JSON.
A render is one finished PDF of up to 20 pages. Billing is in AUD (+ GST for Australian customers); USD prices are a guide at current rates. HTML2PDF is in early access — plans start when your key does. Need more than 87,500 renders a month? Get in touch.
Your first PDF in five minutes
If you can make an HTTP request, you're done — the PDF comes back in the response body, ready to save or send.
curl -X POST https://api.blueport.io/v1/html2pdf \ -H "x-api-key: YOUR_API_KEY" \ -H "content-type: text/html" \ --data-binary @invoice.html \ --output invoice.pdf
Ready to try it?
The guide and Postman collection are ready — HTML2PDF is in early access, so ask for a key and we'll get your first template rendering with you.