Making PDFs Output by Web Systems Accessible - Problems with PDF Generation by Chromium and Proposed Solutions

Making PDFs Output by Web Systems Accessible - Problems with PDF Generation by Chromium and Proposed Solutions

PDFs on websites need to be accessible, yet the well-known way to make them so has been manual work. This article examines making web-system PDFs accessible, reviews Chromium, and shows Takumi and WeasyPrint can produce PDFs passing PDF/UA checks.
2026.11.30

This page has been translated by machine translation. View original

This article is Day 1 of the Accessibility Advent Calendar 2026.

Table of Contents

Introduction

The Web Content Accessibility Guidelines (WCAG) 2.2, the global web accessibility guidelines, cover all web content, including PDF, and Techniques for WCAG 2.2, which shows concrete ways to comply, includes PDF Techniques. In other words, PDFs offered on an accessible website must also be made more accessible according to the file format's specification.

The PDF Techniques are only reference examples, but all 23 current Techniques assume manual work: authoring in tools such as Word, fixing in Acrobat, or editing the PDF directly. No automatic output method is shown.

Web systems automatically generate PDFs such as application receipts, order confirmations, statements, certificates and invoices. As noted, these PDFs also need better accessibility, but opening each one and fixing tags by hand is unrealistic. Hence know-how for making system-generated PDFs accessible is needed.

On the other hand, the Ministry of Health, Labour and Welfare web accessibility policy states its scope as follows:

Scope
For pages managed by the CMS (content management system) introduced in the MHLW information system, we address the “MHLW website”, “Prefectural Labour Bureau websites”, “Regional Bureau of Health and Welfare websites” and “Overseas Infectious Diseases website” (sic).
However, non-HTML web pages such as PDFs are out of scope at present. Information in PDFs etc. will also be published in HTML where possible.

The Tokyo Metropolitan Government site policy lists an exception to its accessibility policy:

  1. PDF, Excel and Word content
    When newly publishing PDF, Excel or Word content, we will in principle strive to describe its outline as text on the website and post the file as an attachment.

PDF files are thus excluded from the accessibility policy.

These texts do not give reasons for excluding PDFs. My guess is that besides low awareness of the PDF Techniques themselves, it is also not widely known how to make PDFs output by web systems accessible.

How Web Systems Output PDFs

The first approach that comes to mind is to run Chromium through something like Playwright and generate a PDF from HTML.

This article outputs PDFs in three ways and checks their accessibility.

  1. Convert HTML to PDF with Chromium (Playwright)
  2. A PDF output by takumi-pdf (PDF/A and PDF/UA support) from Takumi, a free MIT / Apache-2.0 licensed tool that outputs PDFs from JSX without a browser
  3. A PDF output by WeasyPrint, a free BSD-licensed HTML-to-PDF engine said to support PDF/UA-1

Commercial products such as Prince and Antenna House Formatter, as well as Typst, iText and Apache FOP, were not tested this time.

How the Verification Was Done

I assumed an “Application Confirmation (Receipt)” PDF containing elements that tend to cause accessibility problems in Japanese PDFs, and built it with the same content and same font (Noto Sans JP) in three patterns: Chromium, Takumi and WeasyPrint. The code and sample PDFs are published in a GitHub repository.

Element Content
Document title / language Japanese (lang="ja"). Includes one English sentence marked lang="en"
Headings h1, h2 (5), h3 (4; the Japanese typography checks)
Japanese font All text in Japanese (hiragana, katakana, kanji, full-width symbols). Noto Sans JP (variable font)
Japanese typography Variant forms (IVS, compatibility kanji), ruby (ruby), vertical writing (writing-mode: vertical-rl), line-break rules (punctuation that can't start or end a line), characters missing from the font (gaiji)
Bookmarks Generated from headings
Decorative image Logo. Alt text empty (alt="") so it is not read aloud
Meaningful image Bar chart of monthly receipts. With descriptive alt text, marked up with figure and figcaption
Ordered list Application flow
Link Link to a support page
Table 28-row statement. caption, th, thead/tbody/tfoot. Spans multiple pages
Emphasis strong
Header / footer Company name and page number “1 / 3” (repeated on every page)

The HTML (Chromium and WeasyPrint use the same HTML; Takumi uses the same structure in JSX) is semantic markup like this:

<main>                              <!-- entire body -->
<img src="logo.png" alt="">              <!-- decorative image -->
<h1>お申し込み内容のご確認(控え)</h1>
<figure>
  <img src="chart.png" alt="2026年7月から11月までの月別受付件数の棒グラフ。…">
  <figcaption>図1 月別受付件数</figcaption>
</figure>
<table>
  <caption>ご注文明細(28点)</caption>
  <thead><tr><th>品番</th>…</tr></thead>
  <tbody>
    <tr><td>A-001</td><td>ノートPC</td><td>1</td><td>1,980円</td></tr>
    …
  </tbody>
  …
</table>
</main>

This HTML was checked with axe-core 4.14.1 and had 0 violations (report).

Three pages of the sample PDF side by side. Page 1: the title “Application Confirmation (Receipt)” with a logo, the receipt number, a numbered list of the application flow, a sentence with a link to the support page, a bar chart of monthly receipts, and the first 6 rows of the order statement table. Page 2: the rest of the table (A-007 to A-028), the total, and notes. Page 3: Japanese typography checks: variant forms, a sentence with ruby, a vertical-writing box, and a line-break-rule box. Each page has the company name at top right and a page number at the bottom.
The sample PDF used for verification (pages 1–3 of the Chromium PDF)

I used the following tools.

  • veraPDF 1.30 (checked against the PDF/UA-1 = ISO 14289-1 and PDF/A-2a = ISO 19005-2 profiles)
  • axe-core 4.14.1 (checking the input HTML)
  • Extracting and comparing the tag structure (structure tree) with pikepdf (compare_struct.py)
  • Poppler: metadata via pdfinfo, and Japanese font checks via pdffonts and pdftotext (whether fonts are embedded and text can be extracted correctly)
  • Environment: macOS, Playwright 1.65, Chromium 158.0.8127.88 (Chrome for Testing), takumi-pdf 0.21.3, WeasyPrint 70.0

Checker: What Is veraPDF?

veraPDF is an open-source PDF validator that mechanically checks PDF conformance to standards. It is developed by the veraPDF Consortium led by the PDF Association and others. Originally built to validate the long-term archiving standard PDF/A, it also supports the accessibility standard PDF/UA (ISO 14289). It is dual-licensed under GPL v3 and MPL v2. I installed version 1.30 with brew install verapdf.

To check a PDF with veraPDF, you specify the standard to check as a “flavour”.

verapdf --flavour 2a  --format text sample.pdf   # PDF/A-2a
verapdf --flavour ua1 --format text sample.pdf   # PDF/UA-1
verapdf --flavour ua1 --format xml  sample.pdf   # output per-rule results as XML

Results are shown as PASS or FAIL. The XML format (--format xml) outputs the clause of each failed rule (e.g. 7.1-3), its description and the number of failures. The “failed items” tables in this article are built from this XML.

Notes on checking with this tool:

  • Only items that can be judged by machine are checked. For example, it can check “does the Figure tag have alt text”, but not “is the alt text appropriate” or “is the reading order natural”. Passing this tool is a necessary, not sufficient, condition for a PDF to be accessible.
  • Even for PDF/UA-1, results can differ between tools. In practice, I recommend combining it with PAC (PDF Accessibility Checker), Acrobat's accessibility checker and screen reader checks (this time only veraPDF was used).
  • veraPDF runs on the command line and can be built into CI. Takumi's documentation says its developers check with veraPDF in CI.

CI renders test documents at every pdfa level and both PDF/UA levels, then checks each one with veraPDF.

Test A. Chromium (Playwright)

I use Playwright to test Chromium's PDF output, for these reasons.

  • I believe running Chromium through Playwright etc. is a common way for web systems to generate PDFs from HTML (my own impression; I did not research usage share).
  • It lets you specify header/footer templates, tagged PDF, bookmarks and so on in the same form as a real system. The Chromium command line cannot take custom header/footer templates.
  • You can pin the Chromium version, which makes the test reproducible. Here I use the headless shell of Chrome for Testing stable (158.0.8127.88) via Playwright's executablePath.

Playwright is usable from several languages (JavaScript/TypeScript, Python, Java, .NET). I tested only with JavaScript (Node.js); other languages may behave differently.

Playwright's page.pdf() supports tagged PDF (tagged: true) and bookmark generation (outline: true) since version 1.42. To give it the best conditions, I enabled both.

const pdf = await page.pdf({
  format: "A4",
  printBackground: true,
  tagged: true,     // tagged PDF
  outline: true,    // generate bookmarks from headings
  displayHeaderFooter: true,
  headerTemplate: `…`,
  footerTemplate: `…<span class="pageNumber"></span> / <span class="totalPages"></span>…`,
});

page.pdf() calls Chromium's DevTools Protocol method Page.printToPDF. headerTemplate, footerTemplate, generateTaggedPDF (Playwright's tagged) and generateDocumentOutline (Playwright's outline) are Chromium features. Playwright's implementation only converts units and renames options before passing them to Page.printToPDF. So going through Playwright does not limit Chromium's capabilities.

To be safe, I also checked for differences against using Chromium directly. The same HTML was turned into PDF in three ways:

  1. Chrome for Testing headless shell (the type Playwright launches by default)
  2. Chrome for Testing full Chromium (launched from Playwright)
  3. The command line of 2 (--headless=new --print-to-pdf --no-pdf-header-footer --generate-pdf-document-outline)

Headers/footers can't be added from the command line, so none were added in any of the three.

The veraPDF (PDF/UA-1) failures (6 rules / 7 checks) and the tag structure (tag types and counts) were identical across all three. The command-line version needs --generate-pdf-document-outline to produce bookmarks (in Chromium 158, tagged PDF is output by default and can be disabled with --disable-pdf-tagging).

Test B. Takumi (takumi-pdf)

Takumi is a layout engine written in Rust that converts JSX, HTML and CSS into images or PDFs without launching a browser. PDF output is handled by the takumi-pdf package. According to the official docs, this renderer runs on WebAssembly and does not start a browser, so it does not depend on Chromium. However, its layout is said to be a port of Chromium's layout implementation, and it supports only a subset of the CSS features browsers support.

I wrote content equivalent to Test A's HTML in JSX and passed the conformance level to render(). takumi-pdf is an npm package; I wrote the code in TypeScript and ran it on Node.js. The code below is test case 5 (PDF/UA-1 and PDF/A-2a together). For test case 3 I omitted pdfa, for 4 I omitted tagged (the default of tagged is true), and for 1 I omitted both.

import { render } from "takumi-pdf";
import { PageNumber, TotalPages } from "takumi-pdf/primitives";

const pdf = await render(doc, {
  size: "a4",
  fonts: [{ name: "NotoJP", data: font, weight: 400 }],
  images: [{ src: "logo.png", data: logo }, { src: "chart.png", data: chart }],
  lang: "ja",
  outline: true,
  metadata: { title: "お申し込み内容のご確認(控え)", creationDate: "2026-12-01" },
  header: <div>サンプル株式会社</div>,
  footer: <div><PageNumber /> / <TotalPages /></div>,
  pdfa: "2a",       // PDF/A-2a (accessible archive)
  tagged: "ua1",    // build the structure tree and validate as PDF/UA-1
});

With tagged: "ua1", Takumi fails rendering itself if it cannot conform to PDF/UA-1, and reports the violated rules. For example, lang, metadata.title and alt on <img> are required. This design prevents “a PDF got made but actually doesn't conform.”

Test C. WeasyPrint

WeasyPrint is a Python library that converts HTML and CSS to PDF. Its official docs describe it as a “visual rendering engine for HTML and CSS” designed for paged output. It implements layout itself and uses other libraries for HTML/CSS parsing, fonts (Pango) and PDF writing. The docs also say it is not based on a full rendering engine like WebKit or Gecko. Its dependency list (Pango, pydyf, tinycss2, etc.) includes no browser or Chromium, so it appears not to depend on Chromium.

In a Python script I gave the same HTML file as in Test A as input. Headers and footers are specified not with options like page.pdf() in Test A but with CSS @page margin boxes. This reproduces the same content as Tests A and B (company name and page number).

from weasyprint import HTML, CSS

page_css = CSS(string="""
@page { size: A4; margin: 20mm 15mm;
  @top-right { content: "サンプル株式会社" }
  @bottom-center { content: counter(page) " / " counter(pages) } }
""")
HTML("sample.html").write_pdf(
    "weasyprint-ua1.pdf",
    stylesheets=[page_css],
    pdf_variant="pdf/ua-1",       # PDF/UA-1. Also enables tagged PDF
    presentational_hints=True,    # apply HTML attributes such as <img width height>
)

The code above shows only the essentials. The actual code (including font and size settings) is in the repository's weasy.py.

Without pdf_variant="pdf/ua-1" the PDF is untagged (pdf_tags=True alone also adds tags). WeasyPrint also ignores the width/height attributes of <img> by default, so presentational_hints=True was needed.

Results

veraPDF Results for the PDFs from Each Method

I compared the three methods in five test cases, differing in the settings used to improve PDF accessibility.

  • Test case 1: specify nothing (tool defaults); check as PDF/UA-1
  • Test case 2: specify tagged PDF; check as PDF/UA-1
  • Test case 3: specify PDF/UA-1 conformance; check as both PDF/UA-1 and PDF/A-2a
  • Test case 4: specify PDF/A-2a conformance; check as both PDF/UA-1 and PDF/A-2a
  • Test case 5: specify both PDF/UA-1 and PDF/A-2a; check as both PDF/UA-1 and PDF/A-2a

Chromium has no option to specify PDF/UA or PDF/A conformance, so test cases 3–5 can't be specified. Playwright's page.pdf() outputs untagged PDF by default (the default of tagged is false). Takumi is tagged by default, so test cases 1 and 2 give the same output. Takumi can specify PDF/UA and PDF/A with separate options, alone or together. WeasyPrint accepts only one standard in pdf_variant, so test cases 3 and 4 are separate outputs and test case 5 (both at once) is impossible.

Item A. Chromium (Playwright) B. Takumi C. WeasyPrint
1. Nothing specified (default) Untagged PDF. Fail (9 rules / 2,155 checks) Tagged PDF. Fail (2 rules / 2 checks) Untagged PDF. Fail (9 rules / 477 checks)
2. Tagged PDF specified Fail (6 rules / 34 checks. tagged: true and outline: true) Same as 1 (tagged: true) Fail (2 rules / 2 checks. pdf_tags=True)
3. PDF/UA-1 specified No option PDF/UA-1: pass (0). PDF/A-2a: fail (4 rules / 1,039 checks) (tagged: "ua1") PDF/UA-1: fail (1 rule / 1 check). PDF/A-2a: fail (7 rules / 798 checks) (pdf_variant="pdf/ua-1")
4. PDF/A-2a specified No option PDF/UA-1: fail (2 rules / 2 checks). PDF/A-2a: pass (0) (pdfa: "2a") PDF/UA-1: fail (2 rules / 2 checks). PDF/A-2a: fail (1 rule / 2 checks) (pdf_variant="pdf/a-2a")
5. PDF/UA-1 and PDF/A-2a together No option PDF/UA-1: pass (0). PDF/A-2a: pass (0) (tagged: "ua1" + pdfa: "2a") Can't be specified together

In the table, “rules” is the number of failed standard clauses (failedRules in veraPDF's XML), and “checks” is the total number of failed checks (failedChecks). One problem can be counted as several checks. For example, if the header/footer isn't tagged, each content item in it is counted separately as a violation of the same rule (7.1-3).

The Chromium “1. Nothing specified” numbers are for headless shell. With full Chromium the number of failed rules is the same (9) and failed checks are 2,219.

veraPDF reports are saved in samples/verapdf/ of the GitHub repository.

Items Chromium Failed

Test case 2

In “test case 2: tagged PDF specified, checked as PDF/UA-1 (Playwright with tagged: true and outline: true)”, these items failed.

Rule (ISO 14289-1) Description Count
7.1-3 Header/footer (27) and a decorative image (1) are neither marked as Artifact nor tagged as real content 28
7.3-1 The decorative image with alt="" becomes a Figure tag without alt text 1
7.1-5 A non-standard structure type (NonStruct) is not mapped to a standard type in RoleMap 2
7.18.5-2 / 7.18.1-2 The link has no Contents (alternative description) 1 + 1
7.1-8 No XMP metadata (PDF/UA identifier can't be written either) 1

Items WeasyPrint Failed

Test case 2

In “test case 2: tagged PDF (pdf_tags=True), checked as PDF/UA-1”, two checks failed:

Rule (ISO 14289-1) Description Count
7.3-1 The decorative image with alt="" becomes a Figure tag without alt text (same problem as Chromium; adding role="presentation" doesn't change it) 1
7.1-8 No XMP metadata (no PDF/UA identifier either) 1

The header/footer (@page margin boxes) was treated as Artifact, and DisplayDocTitle, Lang, bookmarks, table THead/TBody/TFoot and list LBody were also output (the same holds for test case 3).

Test case 3

Results for “test case 3: PDF/UA-1 conformance specified (pdf_variant="pdf/ua-1"), checked as both PDF/UA-1 and PDF/A-2a”:

Checked as PDF/UA-1, only one failure remained. XMP metadata and the PDF/UA identifier are now output, so 7.1-8, which failed in test case 2, is resolved.

Rule (ISO 14289-1) Description Count
7.3-1 The decorative image with alt="" becomes a Figure tag without alt text (same as test case 2) 1

Checked as PDF/A-2a, 7 rules (798 checks) failed. PDF/A-2a wasn't specified, so this is expected.

Test case 4

In “test case 4: PDF/A-2a conformance specified (pdf_variant="pdf/a-2a"), checked as both PDF/UA-1 and PDF/A-2a”, tagged PDF is also output automatically.
Checked as PDF/A-2a, one rule (2 checks) failed.

Rule (ISO 19005-2) Description Count
6.2.8-3 The image's Interpolate key is not false 2

In WeasyPrint's source, when CSS image-rendering is auto (the default), it writes Interpolate true for images. PDF/A allows only false, so a document with images fails by default. With html { image-rendering: crisp-edges } in CSS (weasy.py pdfa2a-crisp), this rule was resolved and PDF/A-2a passed. The same output checked as PDF/UA-1 failed 2 rules (2 checks): no PDF/UA identifier (5-1) and no alt text on the decorative image's Figure (7.3-1).

Because pdf_variant takes only one standard, test case 5 (PDF/UA-1 and PDF/A-2a together) can't be produced.

Comparing Tag Structure and Metadata

veraPDF checks for rule violations, but doesn't show how far the HTML semantics (headings, lists, tables, images) carried over into the PDF. Assistive technologies like screen readers rely on the structure tree (a tree of structure elements such as headings and tables representing the PDF's logical structure; also called tag structure) to jump between headings, associate table cells with headers, skip decoration and read alt text. So I extracted the structure trees of the PDFs from the three methods and compared how far the HTML semantics were kept or lost. I also compared document-wide information such as language, title display and XMP metadata. The comparison script is compare_struct.py, and its output is in samples/structure/comparison.md (correspondence with table rows is in the repository README).

Checking the structure trees with pikepdf showed these differences. Each column is the best output achievable with that tool. In the tables below, “Chromium” is the output of test case 2 (tagged: true + outline: true), “Takumi (ua1)” is test case 5 (tagged: "ua1" + pdfa: "2a"), and “WeasyPrint (pdf/ua-1)” is test case 3 (pdf_variant="pdf/ua-1") (WeasyPrint can't specify PDF/UA-1 and PDF/A-2a together).

Category Aspect Chromium Takumi (ua1) WeasyPrint (pdf/ua-1)
Element tags Headings (H1/H2), lists, tables, links Yes Yes Yes
Element tags Table THead/TBody/TFoot No (TR directly under Table) THead and TBody yes (TFoot becomes TBody) Yes
Element tags Scope on table header cells Yes Yes No
Element tags Headers on table data cells (referencing header cells) Yes No Yes
Element tags Number of tables 1 1 2 (the table spanning pages becomes a separate Table per page)
Element tags List body (LBody) No Yes Yes
Images Decorative image (alt="") Output as Figure (no Alt) Artifact (not in structure) Output as Figure (no Alt)
Images Alt of meaningful image Yes Yes Yes
Decoration Header/footer Neither tagged nor marked as artifact Excluded as Artifact (about 330 places) Excluded as Artifact
Extra elements NonStruct elements 157 None 10
Document-wide Document language (/Lang) ja ja ja
Document-wide Title display (DisplayDocTitle) Yes Yes Yes
Document-wide XMP metadata / PDF/UA identifier No Yes (pdfuaid:part = 1) Yes (pdfuaid:part = 1)
Document-wide Bookmarks Yes Yes Yes

Takumi's TFoot became TBody because I set display: table-row-group on tfoot to show the total row only on the last page (without it you get TFoot, but the total row repeats on every page). WeasyPrint adds no Scope (column or row header) to TH, but gives every TD a Headers pointing to the ID of its TH, so the header/data cell association can be read from the structure (Takumi is the opposite: Scope on TH, no Headers. Chromium has both Scope on TH and Headers on TD). On the other hand, a table spanning pages becomes a separate Table per page. It is unclear whether header/value association is kept across the split tables (veraPDF doesn't fail it; I didn't check real screen reader output).

Checking Japanese Fonts

In Japanese PDFs, if fonts aren't embedded, text can garble or break depending on the environment, and if the character mapping (ToUnicode) is broken, screen reading, search and copying don't work properly. I checked this too.

Aspect Chromium Takumi (ua1) WeasyPrint (pdf/ua-1)
Font embedded / subsetted Yes Yes Yes
Unicode mapping (uni in pdffonts) Yes Yes Yes
Japanese extractable with pdftotext Extracted correctly (no garbling) Extracted correctly (no garbling) Extracted correctly (no garbling)
Font format Type 3 (about 110 font objects) CID TrueType (Identity-H) (1) CID TrueType (Identity-H) (2; regular and bold)
Unspecified fonts mixed in Yes (system Hiragino Mincho etc. used in header/footer) No No

All three methods extracted the Japanese text correctly as characters (including variant forms). In Takumi, just registering Noto Sans JP as a font made Japanese display and embedding work without trouble.

The difference is in font handling. Chromium outputs variable fonts like this one as Type 3 fonts. The header/footer templates ignored the body's @font-face and were drawn with the runtime's system fonts. Since the font used depends on the runtime (server or container), tofu (□) may appear in environments without Japanese fonts. Takumi doesn't read system fonts, so only registered fonts are used and there are no environment differences.

(NotoSansJP-Thin shown by pdffonts is the variable font's default instance name. Actual drawing uses the specified weight.)

Checking Japanese Typography

I also included Japanese-specific typography at the end of the sample (page 3).

Aspect Chromium Takumi (ua1) WeasyPrint (pdf/ua-1)
Variant forms (IVS, compatibility kanji: 葛󠄁飾区、辻󠄀本、髙橋、﨑山) Display and text extraction fine Display and text extraction fine Display and text extraction fine
Ruby Shown as ruby. Ruby/RT tags also output Not ruby; shown inline at body size, with the readings run into the text (like “receipt hikae contents naiyō…”). No Ruby tag Not ruby; shown inline after the body text, with the readings run into the text (like “receipt hikae contents naiyō…”). No Ruby tag
Vertical writing (writing-mode: vertical-rl) Shown vertically Stays horizontal (unsupported) Stays horizontal (unsupported)
Line-break rules (no period/bracket at line start/end) Fine Fine Fine
Characters missing from font (gaiji: private use U+E000) No error; output as tofu (□) Rendering fails (No font the text can use draws … (U+E000)) Not tested

Three points:

  • Ruby and vertical writing didn't work in Takumi or WeasyPrint. Text with ruby may be read by screen readers with the readings run into the body text, like “receipt hikae contents naiyō” (I didn't check with a real screen reader). Documents needing ruby or vertical writing (invitations, legal documents, etc.) can't be handled by Takumi or WeasyPrint. These are results for the tested versions (takumi-pdf 0.21.3, WeasyPrint 70.0).
  • Takumi is stricter on gaiji. Chromium silently outputs tofu for characters missing from the font, so you may distribute it unnoticed. Takumi fails generation, so you always notice (uncoveredText: "placeholder" lets it continue with tofu, but it can't be combined with PDF/A or PDF/UA settings; placeholder alone did generate here). For systems handling names with gaiji or platform-dependent characters, this strictness is both a plus and a chore.
  • Variant forms (IVS) and line-break rules were fine in all three.

Variant forms, a sentence with ruby, a vertical-writing box and a line-break-rule box are displayed
Page 3 of the Chromium PDF (Japanese typography checks)

Ruby is shown inline with the body text, and the vertical-writing box remains horizontal
Page 3 of the Takumi (tagged: "ua1" + pdfa: "2a") PDF (Japanese typography checks)

Ruby is shown inline with the body text, and the vertical-writing box remains horizontal
Page 3 of the WeasyPrint (pdf_variant="pdf/ua-1") PDF (Japanese typography checks)

Visual Comparison

Appearance is nearly the same in all three. However, in WeasyPrint the table caption (“Order Details (28 items)”) is left-aligned, while Chromium and Takumi center it.

The title, receipt number, application flow, bar chart and part of the order table are displayed
Page 1 of the Chromium PDF

Nearly the same layout and content as the Chromium version
Page 1 of the Takumi (tagged: "ua1" + pdfa: "2a") PDF

Nearly the same layout and content as the Chromium version; only the table caption “Order Details (28 items)” is left-aligned
Page 1 of the WeasyPrint (pdf_variant="pdf/ua-1") PDF

Discussion

Limits of Chromium

Surprisingly, today's Chromium can make tagged PDFs perfectly well. With tagged: true and outline: true, headings, lists, tables, links, Lang and bookmarks are output. “Chromium PDFs have no tags” is now an outdated view.

Still, it falls short of the quality WCAG (and the related PDF/UA) require, for these reasons.

  1. Things that should be decoration aren't. Headers/footers (company name and page number repeated on every page) may be read aloud on every page by screen readers (not checked on a real device). Images written with alt="" in HTML also become Figures without alt text.
  2. Conformance can't be declared. XMP metadata and the PDF/UA identifier can't be output, so “PDF/UA compliant” can't be shown mechanically.
  3. Smaller gaps: no link descriptions, simplified table structure (THead/TBody etc.), and non-standard structure types (NonStruct) mixed in.
  4. Options can't fix it. Playwright's page.pdf() has neither options to control these nor an option to specify PDF/UA or PDF/A conformance. Fixing requires post-processing the PDF with another tool or manual correction in Acrobat, which defeats the point of automation.

Some of these are also reported in Chromium's issue tracker (status as of December 1, 2026).

Item Chromium issue Status
XMP metadata / PDF/UA identifier Accessibility: PDF Prints – Missing XMP Metadata New (unaddressed)
NonStruct mixed in Bogus NonStruct elements appearing in Print to PDF output New (unaddressed)
Table row groups (THead/TFoot) Should we expose blink kRowGroup Won't Fix (Intended Behavior)
Tagged PDF output in general Improve accessibility of PDFs produced through print-to-PDF workflow New (ongoing improvement work)

The XMP issue explains that Chromium doesn't enable Skia's (the PDF-writing library) XMP output, and that the XMP Skia emits has only the PDF/A identifier, not the PDF/UA identifier (pdfuaid). The table row group issue explains that THead and TFoot are ignored in Chromium's accessibility tree, so they don't appear in PDF tags.

I couldn't find similar issues for the missing artifact marking of headers/footers, alt="" images becoming Figures, or missing link descriptions (within the range of public issues I searched).

What Takumi Solved

In Takumi, HTML semantics map directly to PDF tags, and headers/footers and decorative images were automatically excluded from the structure. Missing required inputs such as lang, metadata.title and alt make rendering fail, so accessibility gaps are stopped at generation time. As a result, a PDF passing veraPDF for both PDF/UA-1 and PDF/A-2a was output automatically with settings in code alone.

By test case, Takumi passes the standards you specify. With nothing specified (1) or tagged only (2), only two failures remain, “PDF/UA identifier” and “DisplayDocTitle”, and the structure itself was good. With tagged: "ua1" (3) those two are satisfied and PDF/UA-1 passes. PDF/A-2a needs pdfa: "2a" separately (4), and specifying only one doesn't pass the other standard. Specifying both (5) passes both.

Comparison with WeasyPrint

WeasyPrint with just pdf_variant="pdf/ua-1" (test case 3) also left only one PDF/UA-1 failure, the decorative image. So many of Chromium's problems come from Chromium's PDF output implementation and aren't common to every HTML-to-PDF method.

Main differences between Takumi and WeasyPrint:

Aspect Takumi WeasyPrint
Runtime Node.js, Bun, Cloudflare Workers, browsers, etc. (Rust/WebAssembly) Python (needs libraries such as Pango)
Input JSX / HTML HTML / CSS
Required-field validation Generation fails if lang, title or alt is missing Generates even if missing (separate checking needed)
Decorative image (alt="") Excluded from structure Becomes a Figure without alt text (the one remaining failure here)
Table header/value association Scope on TH Headers on TD (no Scope)
PDF/A-2a + PDF/UA-1 Can be specified together; both pass pdf_variant takes only one, so not together (alone, both fail; PDF/A-2a passes with a CSS workaround)
Ruby / vertical writing Unsupported Unsupported

Issues related to these results are already raised in the Takumi and WeasyPrint repositories (status as of December 1, 2026).

Item Issue Status
WeasyPrint: table spanning pages becomes separate Tables Table and list split into separate structure elements at page breaks Open (unaddressed). The maintainer also acknowledges it as a major accessibility problem
WeasyPrint: PDF/A fails when images exist (Interpolate) Automatically set "image-rendering: crisp-edges" to get valid PDF/A documents Open (no automatic handling; CSS image-rendering: crisp-edges works around it, and PDF/A-2a passed with it here)
WeasyPrint: only one pdf_variant Support for multiple variants Open (answer: “not as simple as allowing multiple values”)
WeasyPrint: aria-hidden images don't become Artifact PDF/UA aria and role attributes Open (alt="" images are not covered by this issue)
WeasyPrint: ruby Add support for ruby tag Open (unsupported)
WeasyPrint: vertical writing (writing-mode) Handle writing-mode Open (unsupported)
Takumi: ruby, vertical writing (writing-mode) Port inline layout from Blink Listed as unchecked items in the porting checklist (the issue itself was closed as not planned on November 9, 2026)

For WeasyPrint's Scope on TH, the issue (#2508) is closed, and the current version associates cells with Headers. Takumi's repeating of tfoot on every page matches Chrome and was implemented in issues (#1829, #1830). display: table-row-group yielding TBody follows the CSS display type, so it doesn't seem to be a bug. For WeasyPrint's alt="" image becoming a Figure, I couldn't find a similar issue (within the range of public issues I searched).

The choice probably depends on the runtime and existing tech stack. In either case, I recommend checking the output with veraPDF or similar after generation.

Caveats

  • Passing machine checks doesn't guarantee accessibility. Neither veraPDF nor Takumi can judge whether reading order or alt text content is appropriate (Takumi's docs also say so). Alt text must be written by people. I didn't check with VoiceOver, NVDA, JAWS etc. or with PAC (PDF Accessibility Checker); these remain pre-release checks.
  • Takumi is not a browser. It supports only part of CSS and doesn't read system fonts, so you must register a font yourself to show Japanese (Noto Sans JP here). Images are also passed as bytes. It isn't suited to turning a screen rendered by browser JavaScript directly into PDF.
  • The Takumi (takumi-pdf) tested is version 0.21.3 (below 1.0). The API may change in future.
  • When a table spans pages, <tfoot> (total row etc.) repeats on every page by default in all three tools. To show it only on the last page, set display: table-row-group on tfoot (done in this sample). The header row (<thead>) is left repeating on each page. I also set break-after: avoid on headings so they aren't stranded at the bottom of a page.
  • Japanese typography was checked only within the sample's scope (variant forms, ruby, vertical writing, line-break rules, gaiji). Combining characters, tate-chu-yoko, warichu, glyph differences between fonts etc. were not tested.
  • The “ruby”, “vertical writing” and “gaiji” results above are behavior for the tested versions (takumi-pdf 0.21.3, WeasyPrint 70.0, Playwright 1.65, Chromium 158).
  • Commercial products such as Prince and Antenna House Formatter, Typst (supports PDF/UA-1), iText and Apache FOP were not tested.
  • The sample verified here is a single HTML file and doesn't cover the behavior of every HTML element.

Summary

  • Chromium (Playwright) HTML-to-PDF can make tagged PDF with tagged: true and outline: true, but the PDF/UA-1 machine check shows 34 failures (missing artifact marking on headers/footers, decorative image, link descriptions, metadata, etc.) that generation options can't fix. There is also no option to specify PDF/UA or PDF/A.
  • With tagged: "ua1" and pdfa: "2a" together, Takumi automatically output a PDF passing both PDF/UA-1 and PDF/A-2a with the same content. That generation fails when required fields are missing is also a reassuring mechanism for accessibility staff.
  • WeasyPrint with pdf_variant="pdf/ua-1" left only one PDF/UA-1 failure, the decorative image (pdf_variant takes only one value, so it can't be combined with PDF/A-2a). With non-browser engines, automatically outputting accessible PDFs is quite realistic.
  • For application receipts, invoices, statements and other PDFs output by web systems, these look like strong options. Human checks of alt text quality and reading order are still needed.

The code, sample PDFs and veraPDF reports used for verification are at motchie/accessible-pdf-generation-sample.

npm install
pip install -r requirements.txt   # WeasyPrint (needs Pango) and pikepdf for checking the structure tree
# place fonts/NotoSansJP.ttf (see the repository's fonts/README.md)
# Chromium used by Playwright:
#   To use the same Chromium 158 as in this test (Chrome for Testing's chrome-headless-shell), set the environment variable CHROMIUM_EXECUTABLE to its executable path
#   If not set, the Chromium bundled with Playwright (installed by npx playwright install chromium) is used

# Test case 1: specify nothing
npm run chromium:default   # out/chromium-default.pdf and out/sample.html (WeasyPrint input, so run this first)
npm run takumi:plain       # out/takumi-plain.pdf (Takumi is tagged by default, so test case 2 is the same)
python weasy.py default    # out/weasyprint-default.pdf

# Test case 2: specify tagged PDF
npm run chromium           # out/chromium.pdf
python weasy.py tags       # out/weasyprint-tags.pdf

# Test case 3: specify PDF/UA-1
npm run takumi:ua1only     # out/takumi-ua1only.pdf
python weasy.py ua1        # out/weasyprint-ua1.pdf

# Test case 4: specify PDF/A-2a
npm run takumi:pdfaonly    # out/takumi-pdfaonly.pdf
python weasy.py pdfa2a     # out/weasyprint-pdfa2a.pdf
python weasy.py pdfa2a-crisp   # out/weasyprint-pdfa2a-crisp.pdf (PDF/A-2a workaround with `image-rendering: crisp-edges` added)

# Test case 5: specify PDF/UA-1 and PDF/A-2a together
npm run takumi             # out/takumi-ua1.pdf

# Gaiji check (Chromium and Takumi)
npm run gaiji              # out/gaiji-*.pdf

# Format the input HTML and check with axe-core
npm run sample-html        # samples/sample.html (formats out/sample.html with relative reference paths)
npm run axe                # samples/axe-report.json

# Check each output PDF as PDF/UA-1 and PDF/A-2a
verapdf --flavour ua1 --format text out/takumi-ua1.pdf
verapdf --flavour 2a --format text out/takumi-ua1.pdf

# Compare tag structure and metadata
python compare_struct.py out/chromium.pdf out/takumi-ua1.pdf out/weasyprint-ua1.pdf

Share this article