Skip to main content

Invoices & receipts

Invoices and receipts are the canonical PDF-Server use case: high volume, data-driven, and often filled with end-user data (names, addresses, line items).

Why PDF Server fits

  • Validation first. A schema.json rejects malformed data with a 422 before anything renders — you never ship a broken invoice.
  • Real CSS. Totals tables, page breaks, and print-specific layout via @page and PDF params.
  • Running totals in headers/footers with page numbers.
  • Safe by construction. Because the data is untrusted, use auto-escaping engines and follow the hardening checklist — never route customer data into raw-HTML sinks.

Shape

templates/invoice/
template.handlebars # layout
header.handlebars # logo + invoice number
footer.handlebars # page X of Y
schema.json # required fields, types
params.json # A4, margins, printBackground
examples/sample.json

Render one per request:

curl -X POST -H 'Content-Type: application/json' \
-d @invoice-4711.json \
https://pdf.internal/templates/invoice/render > invoice-4711.pdf

At scale, raise RENDER_POOL_MAX_TOTAL and put the service behind your authenticating gateway.