Skip to content

HTML to PDF API for production documents

Generate statements, reports, contracts and certificates from the HTML and CSS your application already renders. One request in, a finished document back, with the paper size, margins and repeating furniture you set.

Create a free accountRead the API docs

  • 100 free PDFs each month
  • Any page size
  • No charge for failed renders
  • UK-operated infrastructure
A4
Page 1 of 3

One request

You already built this document once

Most PDF libraries ask you to rebuild a layout you have already written in HTML and CSS, in a drawing API with its own units, fonts and box model. The document on screen and the document in the attachment then drift apart, and every change costs twice.

Ironfang Render prints the markup you already have, in a real browser, with the paper size, margins, scale and repeating header and footer set per request. One template, two outputs, one place to change it.

POST /render/v1/pdf
Authorization: Bearer if_live_...
Content-Type: application/json

{
  "html": "<html>...your document...</html>",
  "paper_format": "a4",
  "print_background": true,
  "margin": { "top": 0.6, "bottom": 0.8 },
  "header_html": "<span></span>",
  "footer_html": "<p style='font-size:9px'>Page <span class='pageNumber'></span></p>"
}

200 OK
Content-Type: application/pdf

Capabilities

Document controls, as request parameters

The print settings you would otherwise chase through a browser dialogue, set per request and identical every time.

Use cases

Documents worth generating rather than designing twice

Anywhere your application already renders the content and somebody needs it as a file.

Statements and remittances

Period statements and remittance advice, rendered from the same template your account screens already use.

Order confirmations

Attach a printable confirmation to the email your application already sends, produced from one request.

Reports and exports

Turn a dashboard or a report page into a document somebody can file, print or forward.

Certificates and passes

Personalise per recipient with variables, and composite a verified QR code into the layout.

Contracts and letters

Produce consistent, branded documents from HTML rather than from a word processor template nobody owns.

Printable dashboards

Print an authenticated view on a schedule so the weekly pack builds itself.

A complete request, and what it returns

Send the HTML, or a url instead, to POST /render/v1/pdf with your API key. A success is 200 with Content-Type: application/pdf and the document as the body. Anything else is JSON, {"error": {"code", "message"}}, so check the status before saving the body as a PDF. This renders the invoice template from the guide:

curl -sS https://api.ironfang.com/render/v1/pdf \
  -H "Authorization: Bearer $IRONFANG_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @request.json \
  -o invoice.pdf \
  -w '%{http_code} %{content_type}\n'

200 application/pdf means invoice.pdf is the invoice. Download request.json, the HTML template it was built from, or the PDF it produces.

What to know before you integrate

  • Paper: A3, A4, A5, Letter, Legal and Tabloid, portrait or landscape. Without a paper format the page is Letter, and the requested format wins over a stylesheet's @page size.
  • Margins are in inches, per side. Headers and footers draw inside the margins, so leave room for them.
  • Sending only a footer makes Chromium print its default date and title header; send "header_html": "<span></span>" with it.
  • Backgrounds are left out unless print_background is true.
  • Fonts are the renderer's own: load any other with @font-face from a public URL or data URI. Images and stylesheets must be reachable from the public internet.
  • Page breaks follow CSS: break-inside: avoid keeps a row or block whole, and a table's thead repeats on each page.
  • PDFs are never cached, and signed URLs do not serve PDFs. Keep the documents you issue; a batch job can deliver them to your own S3 bucket.
  • A render stops after 30 seconds; a failed render counts nothing.

Try it free in the browserPython example

Page 1 of the PDF this request returns: invoice INV-1042 from Northwind Studio Ltd, six line items and a total due of 13,410.00 pounds.
The first page of invoice.pdf, from the invoice template guide.

Generating invoices?

A billing run needs more than one rendered document: thousands of them on the first of the month, an archived copy you own, and a download link a customer can use without your application streaming the bytes. That has its own page, and the invoice PDF guide has a complete invoice template, the request that renders it and the PDF it produces.

Pricing

Priced per PDF, not per page

Each PDF counts once, every page up to 100 included; a longer document is refused and counts nothing. PDFs are never cached, so every request renders afresh, and a failed render counts nothing. Every account has a free allowance each month, with no card required. Past it, Pay as you go charges the rates below, within the monthly usage limit you set. Prices exclude VAT.

PDFs

Each PDF returned or stored, every page within the page limit included.

100 PDFs free each month

Paid units after the free allowanceRate per 1,000
First 10,000£1.50
Next 90,000£0.70
Next 900,000£0.50
Above 1,000,000£0.40

See Ironfang Render pricingCompare with other providers

Questions

Before you integrate

The details that decide whether this fits, without reading the whole reference first.

Can I send HTML directly instead of a URL?
Yes, and it is the common case. Send the HTML your application already renders and it is printed as-is, so the document you can see in your own application is the document that arrives as a file.
Which paper sizes are supported?
A3, A4, A5, Letter, Legal and Tabloid, in portrait or landscape, with margins in inches for each side and a scale factor you set per request.
Can I put a header and footer on every page?
Yes. Supply header and footer HTML and it repeats on each page, which is where page numbers, a logo or a document reference usually belong.
Why are my background colours missing?
Browsers do not print backgrounds by default. Turn print backgrounds on in the request and your CSS colours, tints and panels come through.
Does the page need to be public?
No. A PDF request takes the same custom headers, Authorization header and cookies as a screenshot, so a document behind a login prints the same way.
What does a PDF cost?
Each PDF counts once against the PDF meter, every page up to 100 included; a longer document is refused and counts nothing. Every PDF request renders the document afresh, a failed render counts nothing, and paid work that would pass the monthly usage limit you set is refused before it starts. The free allowance and the rates are under Pricing on this page.
Can I include a QR code in the document?
Yes. Generate the code with the QR endpoint, which is never charged and checks that the code scans before returning it, then place it in your HTML as an image. It prints as part of the layout like any other image.

Less to operate. More to ship.

Generate your first document

Create an account, take a key and send your existing HTML. Every account has free PDFs each month.

100 free PDFs each month, no card required, and no charge for failed renders.