PDF/A from HTML: what it is, when you need it, how to produce it

Auditors, registries and archives ask for PDF/A. What the standard requires, why an ordinary browser PDF fails it, and how to convert.

Updated 31 August 2026

PDF/A is the archival profile of PDF: a file that will open identically in twenty years because everything it needs is inside it — fonts embedded, colours defined, no JavaScript, no encryption, no external references.

Who asks for it

Public-sector tenders, court filings in several jurisdictions, long-term records in regulated industries (pharma, finance), and any archive that intends to keep the document longer than the software that made it.

Why a browser PDF is not PDF/A

Chromium's `page.pdf()` produces a valid, compact PDF that is not conformant: fonts may be subsetted without the required metadata, there is no output intent (the colour profile that says what "red" means), and the XMP metadata block that declares the conformance level is missing. Viewers open it fine; a validator rejects it.

Producing it

The practical route is to render normally and convert with Ghostscript, which embeds an ICC profile, writes the output intent and the XMP declaration, and flattens anything the profile forbids:

gs -dPDFA=2 -dBATCH -dNOPAUSE -sColorConversionStrategy=RGB \
   -sDEVICE=pdfwrite -dPDFACompatibilityPolicy=1 \
   -sOutputFile=out.pdf pdfa_def.ps in.pdf

`pdfa_def.ps` is a small PostScript file naming the ICC profile. Level 2b (visual appearance preserved) is what most requirements mean; 2u additionally guarantees text can be extracted; 1b is older and stricter.

Through PDFGeny this is a flag:

{"html": "…", "pdfa": true}

Validate, do not assume

Ghostscript converts; it does not certify. Run a sample through veraPDF (free, the reference validator) before promising conformance to a client. Transparency, embedded video and some font types are where conversions fail.

What you lose

File size goes up (embedded profiles and full fonts), and anything interactive — form fields with scripts, links to external files — is removed or flattened. That is the point of the format.

Try it: convert HTML to PDF in the browser, or get a free API key — 50 documents a month.

More guides

Writing HTML templates for PDF: a style guide (Jinja, Django, Handlebars)

Templates that render well as PDFs follow a few rules: fixed page geometry, no external state, defensive filters, print CSS. Examples in Jinja and Django syntax.

Issuing 5,000 course certificates in one afternoon

A spreadsheet of names, one landscape template, batch requests of 100, and signed links per student. The full workflow including naming, verification codes and delivery.

Generating receipts at checkout without slowing the checkout

The receipt PDF should never sit between the customer and the order confirmation. A pattern: confirm first, render asynchronously, attach when ready.

URL-to-PDF and SSRF: how a PDF renderer becomes an attack surface

A renderer that fetches URLs can be pointed at your internal network. The attacks, the defences, and what to demand from a PDF API vendor.