Create PDF/A and Tagged PDFs

This guide shows how to create PDF/A and tagged PDFs with PDFCrowd's HTML to PDF API. PDF/A provides an archival format for long-term preservation. Tagged PDFs carry document structure, such as headings, lists, and reading order, for readers and assistive tools. Choose the output setting that matches the document's intended use.

Choose an output setting

Goal Setting
Archive the document's visual appearance setConformance("PDF/A-2b")
Archive with tagged structure and Unicode text setConformance("PDF/A-2a")
Request tagged structure without PDF/A setTaggedPdf(True)
Archive with arbitrary attached files setConformance("PDF/A-3b")

The conformance reference lists the supported PDF/A-2, PDF/A-3, and PDF/A-4 variants. The examples below illustrate PDF/A-2b and PDF/A-2a; a receiving system may require a different level.

Generate an archival PDF

Set setConformance() before converting the HTML. This example converts report.html to PDF/A-2b.

The example uses Python. The same conversion settings work with any supported client library or the HTTP API.

To run it, install the Python client and set API credentials in the API_USERNAME and API_KEY environment variables. Both can be set to "demo" for testing.

import os

import pdfcrowd

client = pdfcrowd.HtmlToPdfClient(
    os.environ["API_USERNAME"],
    os.environ["API_KEY"],
)
client.setPageSize("A4")
client.setConformance("PDF/A-2b")

client.convertFileToFile("report.html", "report-archive.pdf")

For a webpage input, the final conversion call would be:

client.convertUrlToFile("https://your-domain.example/report/", "report-archive.pdf")

PDF/A constrains features such as font embedding, color information, and metadata so the document can be reproduced over time. Validate the generated PDF against the selected level before using it in a workflow that requires conformance.

Preserve document structure

Use setTaggedPdf(True) to request tagged output. With a newly initialized client, this variation produces a tagged PDF without requesting PDF/A:

client.setTaggedPdf(True)

client.convertFileToFile("report.html", "report-tagged.pdf")

The source HTML supplies the structure. Use headings for headings, list elements for lists, and meaningful text for links. For example, this could form the body of report.html:

<main>
  <h1>Workshop report</h1>
  <p>Attendance increased across the two sessions.</p>

  <h2>Next steps</h2>
  <ul>
    <li>Publish the session recordings.</li>
    <li>Send the feedback survey.</li>
  </ul>

  <p><a href="https://your-domain.example/workshops/">Upcoming workshops</a></p>
</main>

Include the document language on the <html> element, such as lang="en", and a descriptive <title> in the page's <head>. Use appropriate alternative text for informative images and check the resulting PDF's structure and reading order.

Tagged structure is one part of an accessible PDF. Enabling this option does not by itself guarantee PDF/UA, WCAG, or compliance with a particular accessibility policy.

Combine PDF/A and tagged structure

The supported PDF/A a levels include tagged structure and Unicode text. To request PDF/A-2a, use this conformance setting before conversion:

client.setConformance("PDF/A-2a")

client.convertFileToFile("report.html", "report-archive-tagged.pdf")

For archival PDFs containing XML, spreadsheets, or other supporting files, see the PDF attachments guide. PDF/A-3 supports arbitrary file types; select an a variant when tagged structure is also required.

Verify the output

Use a conformance validator such as veraPDF to check PDF/A output. For example, with its command-line tool installed:

verapdf --flavour 2b report-archive.pdf
verapdf --flavour 2a report-archive-tagged.pdf

The validation report identifies whether the file passes the selected profile and lists any failures. A PDF/A label in the document's metadata is not a substitute for validation.

For tagged output, inspect the tag tree and reading order in a PDF tool that exposes them, then test relevant tasks with the assistive technology your audience uses. Automated checks do not establish that headings, alternative text, or reading order make sense to a reader.

In WordPress

In the Save as PDF plugin, open Expert Settings → PDF Format. Choose a Conformance level for PDF/A output, or enable Tagged PDF to preserve document structure. The same source-content and output-verification considerations apply.

Check compatibility

  • PDF/A conformance: the API cannot combine it with encryption, fillable PDF forms, watermarks, or backgrounds.
  • Tagged PDF: the API cannot combine it with watermarks or backgrounds.
  • Client and converter versions: both options require API client 6.7.0 or later and converter 24.04 or later. See the option references for their supported values and constraints.