Skip to content

HTML to PDF

POST /render/html takes a JSON body with the HTML you want to render and returns a PDF/A-3a document with PDF/UA accessibility.

Terminal window
curl -X POST http://localhost:8080/render/html \
-H "Content-Type: application/json" \
-d '{"html":"<html lang=\"en\"><head><title>Doc</title></head><body><h1>Hi</h1></body></html>"}' \
--output out.pdf

Set a lang attribute and a <title> — both are required for accessible output. Bundled fonts are available by font-family (no system fonts needed), and wide tables paginate automatically.

If the document already lives at a public URL, use URL to PDF instead and let the API fetch the HTML for you.

Edit the HTML below and render it through POST /render/html to preview the accessible PDF. The editor is the embeddable HtmlEditor from the template builder package.

The JSON body accepts these fields:

FieldDefaultMeaning
htmlThe complete HTML document to render (required)
baseUrlOptional base URL used to resolve relative <img>, <link>, and <script> references inside the HTML
attachmentsOptional PDF/A-3 file attachments to embed in the output
embedColorProfiletrueEmbed the ICC output intent and produce PDF/A-3a + PDF/UA output. Set to false only when you explicitly need PDF/UA output without the PDF/A color profile, for example benchmark size comparisons.

By default, POST /render/html returns the PDF body as application/pdf. Send Accept: application/json to get { validation, pdf }, where validation is the veraPDF result and pdf is the base64-encoded PDF. JSON negotiation cannot be combined with X-Upload-Url.

Rendering uses OpenHTMLToPDF, a static renderer. It supports:

  • CSS 2.1 (the box model, tables, floats) and a subset of CSS3 (colors, backgrounds, borders)
  • @page for page size/margins and page-break-before/after/inside
  • @font-face and the bundled font families
  • Inline SVG and raster images (JPEG, PNG, GIF, and WebP)

It does not support:

  • JavaScript (no scripts run)
  • CSS Flexbox or Grid
  • CSS transitions/animations and most modern dynamic layout

Design documents with classic block/table/float layout. See the openhtmltopdf docs for the authoritative feature list.

Use the sample request above to render a PDF from your own tooling.