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.
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.pdfSet 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.
Try it
Section titled “Try it”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.
Request body
Section titled “Request body”The JSON body accepts these fields:
| Field | Default | Meaning |
|---|---|---|
html | — | The complete HTML document to render (required) |
baseUrl | — | Optional base URL used to resolve relative <img>, <link>, and <script> references inside the HTML |
attachments | — | Optional PDF/A-3 file attachments to embed in the output |
embedColorProfile | true | Embed 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. |
Response format
Section titled “Response format”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.
HTML & CSS support
Section titled “HTML & CSS support”Rendering uses OpenHTMLToPDF, a static renderer. It supports:
- CSS 2.1 (the box model, tables, floats) and a subset of CSS3 (colors, backgrounds, borders)
@pagefor page size/margins andpage-break-before/after/inside@font-faceand 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.