PdfBroker.io is a cloud-based PDF generation REST API that supports generating compliant PDF/A and PDF/UA documents through its WeasyPrint service. This guide explains the difference between the two standards, when you need each one, and how to generate compliant documents using simple API calls. If you are preparing for the European Accessibility Act (EAA), which requires accessible digital documents from June 2025, PdfBroker.io's PDF/UA support provides a straightforward path to compliance.
Understanding PDF/A and PDF/UA
PDF/A — Archival Compliance
PDF/A is an ISO standard for long-term archival of electronic documents. A PDF/A file is self-contained: all fonts are embedded, no external dependencies exist, and the document will render identically decades from now. Common use cases include tax invoices, legal contracts, government filings, and medical records.
PdfBroker.io's WeasyPrint service supports these PDF/A variants:
| Variant | Standard | Use Case |
|---|---|---|
pdf/a-1b |
ISO 19005-1 | Basic archival, widest compatibility |
pdf/a-2b |
ISO 19005-2 | Adds JPEG2000, transparency support |
pdf/a-3b |
ISO 19005-3 | Allows embedded attachments (e.g., XML data) |
pdf/a-2u, pdf/a-3u |
ISO 19005-2/3 | Level B plus guaranteed Unicode text extraction |
pdf/a-1a, pdf/a-2a, pdf/a-3a |
ISO 19005-1/2/3 | Level A — archival and tagged for accessibility |
pdf/a-4u |
ISO 19005-4 | Latest standard, based on PDF 2.0 |
pdf/a-4f, pdf/a-4e |
ISO 19005-4 | PDF/A-4 with embedded files, or the engineering profile |
There is no pdf/a-4b: PDF/A-4 dropped the A/B conformance lettering and requires Unicode mapping throughout, so pdf/a-4u is the baseline. Requesting pdf/a-4b returns a 400 Bad Request.
PDF/UA — Accessibility Compliance
PDF/UA (Universal Accessibility) is an ISO standard (ISO 14289) that ensures PDF documents are accessible to people using assistive technologies such as screen readers. A PDF/UA document has a tagged structure, a logical reading order, and alternative text for non-text elements.
PdfBroker.io's WeasyPrint service supports:
| Variant | Standard | Use Case |
|---|---|---|
pdf/ua-1 |
ISO 14289-1 | Accessible PDFs for screen readers and assistive technology |
pdf/ua-2 |
ISO 14289-2 | The PDF 2.0 revision of the same standard — newer tag model, thinner tooling support |
Stay with pdf/ua-1 unless a recipient has specifically asked for UA-2.
The European Accessibility Act
The European Accessibility Act (EAA, Directive 2019/882) requires businesses selling products and services in the EU to make their digital content accessible. This applies to PDFs published on websites, sent to customers, or provided as part of a digital service. The EAA took effect in June 2025, making PDF/UA compliance increasingly important for businesses operating in the EU.
Prerequisites
- A PdfBroker.io account with a Starter plan or above (WeasyPrint is a premium service)
- Your Client ID and Client Secret from Members API Credentials
- See the Authentication documentation for token setup
Step 1: Structure Your HTML for Compliance
Both PDF/A and PDF/UA benefit from well-structured HTML. For PDF/UA specifically, the tagged structure of the PDF is derived from your HTML semantics, so using proper elements is essential.
Key HTML practices for PDF/UA
<!DOCTYPE html>
<html lang="en"> <!-- Always set the document language -->
<head>
<meta charset="UTF-8">
<title>Quarterly Report Q1 2026</title> <!-- Meaningful title -->
<style>
body { font-family: Arial, sans-serif; }
h1 { color: #6462a8; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #6462a8; color: white; }
</style>
</head>
<body>
<h1>Quarterly Report — Q1 2026</h1>
<p>This report summarizes the financial performance of Acme Corp
for the first quarter of 2026.</p>
<!-- Use proper heading hierarchy: h1 > h2 > h3, no skipping -->
<h2>Revenue Summary</h2>
<!-- Tables must have headers for screen readers -->
<table>
<thead>
<tr>
<th>Month</th>
<th>Revenue</th>
<th>Expenses</th>
</tr>
</thead>
<tbody>
<tr><td>January</td><td>€45,000</td><td>€32,000</td></tr>
<tr><td>February</td><td>€52,000</td><td>€34,000</td></tr>
<tr><td>March</td><td>€48,000</td><td>€31,000</td></tr>
</tbody>
</table>
<!-- All images need descriptive alt text -->
<h2>Revenue Trend</h2>
<img src="chart.png" alt="Bar chart showing monthly revenue increasing
from €45,000 in January to €52,000 in February, then decreasing
slightly to €48,000 in March." />
<!-- Use lists for list-like content -->
<h2>Key Highlights</h2>
<ul>
<li>Total Q1 revenue: €145,000</li>
<li>Operating margin improved by 3 percentage points</li>
<li>New customer acquisition up 15% compared to Q4 2025</li>
</ul>
</body>
</html>
Key rules for PDF/UA compliance:
- Set
langon the<html>element - Use a logical heading hierarchy (
h1→h2→h3, never skip levels) - Include
alttext on all<img>elements - Use
<thead>and<th>for table headers - Avoid using images of text — use real text elements
- Give the document a meaningful
<title>
Step 2: Generate a PDF/A Document
To produce a PDF/A document, add the pdf-variant argument to your WeasyPrint API call.
C# with PdfBroker.Client
using PdfBroker.Client;
using PdfBroker.Common.RequestObjects;
var client = new PdfBrokerClientService("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
var html = await File.ReadAllTextAsync("report.html");
var request = new WeasyPrintRequestDto
{
HtmlBase64String = Convert.ToBase64String(
System.Text.Encoding.UTF8.GetBytes(html)),
WeasyPrintToPdfArguments = new Dictionary<string, string>
{
{ "pdf-variant", "pdf/a-3b" }
}
};
byte[] pdfBytes = await client.WeasyPrintAsByteArrayAsync(request);
await File.WriteAllBytesAsync("report-pdfa.pdf", pdfBytes);
cURL
ACCESS_TOKEN=$(curl -s -X POST https://login.pdfbroker.io/connect/token \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \
| jq -r '.access_token')
HTML_BASE64=$(base64 -w 0 report.html)
curl -X POST https://api.pdfbroker.io/api/pdf/weasyprint \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"htmlBase64String\": \"$HTML_BASE64\",
\"weasyPrintToPdfArguments\": {
\"pdf-variant\": \"pdf/a-3b\"
}
}" \
--output report-pdfa.pdf
Python
import requests
import base64
# Authenticate
token_resp = requests.post(
"https://login.pdfbroker.io/connect/token",
data={
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
},
)
access_token = token_resp.json()["access_token"]
# Load HTML
with open("report.html", "r", encoding="utf-8") as f:
html_b64 = base64.b64encode(f.read().encode("utf-8")).decode("ascii")
# Generate PDF/A-3b
response = requests.post(
"https://api.pdfbroker.io/api/pdf/weasyprint",
headers={"Authorization": f"Bearer {access_token}"},
json={
"htmlBase64String": html_b64,
"weasyPrintToPdfArguments": {"pdf-variant": "pdf/a-3b"},
},
)
response.raise_for_status()
with open("report-pdfa.pdf", "wb") as f:
f.write(response.content)
Step 3: Generate a PDF/UA Document
The process is identical — just change the pdf-variant value to pdf/ua-1. The quality of the accessibility tagging depends on the semantic quality of your HTML input.
C# with PdfBroker.Client
using PdfBroker.Client;
using PdfBroker.Common.RequestObjects;
var client = new PdfBrokerClientService("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
var html = await File.ReadAllTextAsync("accessible-report.html");
var request = new WeasyPrintRequestDto
{
HtmlBase64String = Convert.ToBase64String(
System.Text.Encoding.UTF8.GetBytes(html)),
WeasyPrintToPdfArguments = new Dictionary<string, string>
{
{ "pdf-variant", "pdf/ua-1" }
}
};
byte[] pdfBytes = await client.WeasyPrintAsByteArrayAsync(request);
await File.WriteAllBytesAsync("report-pdfua.pdf", pdfBytes);
cURL
curl -X POST https://api.pdfbroker.io/api/pdf/weasyprint \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"htmlBase64String\": \"$HTML_BASE64\",
\"weasyPrintToPdfArguments\": {
\"pdf-variant\": \"pdf/ua-1\"
}
}" \
--output report-pdfua.pdf
Python
import requests
import base64
# Authenticate
token_resp = requests.post(
"https://login.pdfbroker.io/connect/token",
data={
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
},
)
access_token = token_resp.json()["access_token"]
# Load HTML
with open("accessible-report.html", "r", encoding="utf-8") as f:
html_b64 = base64.b64encode(f.read().encode("utf-8")).decode("ascii")
# Generate PDF/UA-1
response = requests.post(
"https://api.pdfbroker.io/api/pdf/weasyprint",
headers={"Authorization": f"Bearer {access_token}"},
json={
"htmlBase64String": html_b64,
"weasyPrintToPdfArguments": {"pdf-variant": "pdf/ua-1"},
},
)
response.raise_for_status()
with open("report-pdfua.pdf", "wb") as f:
f.write(response.content)
Step 4: Validate the Output
A successful API call is not proof of conformance. Validate the generated file with a tool PdfBroker.io does not control.
veraPDF is the open source reference validator for both PDF/A and PDF/UA. It is developed by the Open Preservation Foundation together with the PDF Association — the organisations that maintain the ISO standards themselves — which is why it is the tool most auditors reach for. It runs from the command line, so it fits into a build:
verapdf --flavour 3b report-pdfa.pdf
verapdf --flavour ua1 report-pdfua.pdf
PAC (PDF Accessibility Checker) is a free Windows tool from axes4 covering PDF/UA and WCAG. Its screen reader preview and visual tag tree make structural problems obvious in a way a text report does not — useful when you need to see why a document failed rather than just that it did.
Adobe Acrobat Pro covers PDF/A through its preflight profiles and much of PDF/UA through its accessibility checker.
One thing worth knowing before a compliance review: validators disagree. The same document can pass one tool and fail another, because each interprets parts of the ISO text differently. For anything going to an auditor, run at least two.
A good habit is to run veraPDF in CI against one representative document per template. Conformance breaks quietly — a designer swapping in a new font is enough to lose it.
Choosing the Right Variant
| Requirement | Recommended Variant |
|---|---|
| Long-term archival (tax, legal, government) | pdf/a-3b |
| Maximum compatibility with older systems | pdf/a-1b |
| Archival with embedded attachments (XML invoices) | pdf/a-3b |
| Screen reader and assistive technology support | pdf/ua-1 |
| European Accessibility Act compliance | pdf/ua-1 |
| Both archival and accessibility | pdf/a-2a (level A is archival and tagged) |
Common Pitfalls
Missing lang attribute. PDF/UA validators will flag documents without a language declaration. Always set lang on your <html> tag.
Images without alt text. Every <img> element in your HTML must have a descriptive alt attribute. Decorative images should use alt="" (empty string).
Skipped heading levels. Going from <h1> directly to <h3> breaks the document's logical structure. Screen readers use heading levels to navigate the document.
Using wkhtmltopdf instead of WeasyPrint. PDF/A and PDF/UA compliance is only available through PdfBroker.io's WeasyPrint service. The wkhtmltopdf service does not support these variants.
Summary
Generating compliant PDF/A and PDF/UA documents with PdfBroker.io is a single API parameter change. Write well-structured HTML, set the pdf-variant argument to your desired standard, and the WeasyPrint service handles the rest — embedding fonts, creating tagged structures, and producing ISO-compliant output. For European Accessibility Act compliance, combine semantic HTML practices with the pdf/ua-1 variant.
Related Resources
- WeasyPrint PDF Variants Reference — Every
pdf-variantvalue, what each conformance level guarantees, and the HTML requirements for each - WeasyPrint as a Service — Full API reference for the WeasyPrint endpoint
- How to Generate PDF Invoices from HTML with a REST API — Invoice generation with PDF/A
- Working with Fonts — Embedding custom fonts in compliant PDFs
- Content Negotiation — Binary vs JSON response formats
- Pricing — WeasyPrint requires Starter plan or above