PDF/UA in C#: accessible PDFs from .NET
To make a PDF/UA document in C# with Tagua, declare it in the template, with a title, a language and embedded fonts, and render it as any other report:
title: Quarterly statementlanguage: en-GBdocument: { compliance: [pdf-ua-1] }fonts: Inter: { regular: fonts/Inter-Regular.ttf, bold: fonts/Inter-Bold.ttf }var template = TemplateLoader.LoadFile("statement.report.yaml");var report = CompiledReport.Compile(template);await using var pdf = File.Create("statement.pdf");await Reports.RenderPdfAsync(report, inputs, pdf);Every document Tagua writes is tagged, and with pdf-ua-1 it checks the template for what PDF/UA requires before
reading any data. The output passes veraPDF, the reference validator: Tagua’s own build checks
every sample against the standards it claims, on every change. The rest of this page explains what makes a PDF
accessible, shows a complete example, and how to make your RDLC reports accessible.
What an accessible PDF is
Section titled “What an accessible PDF is”An accessible PDF is one that people who use screen readers, magnifiers or keyboards can read as well as anyone else. Visually it looks like any other PDF; what makes the difference is a structure tree inside it, which says what each thing on the page is (a heading, a paragraph, a table cell, an image and its description) and the order to read them in. That is a tagged PDF, and PDF/UA (ISO 14289) is the standard that says what a tagged PDF must contain to be accessible.
Accessibility is also a legal requirement more and more often: the European Accessibility Act applies to many digital services in the EU from June 2025, public bodies in the EU and the US (Section 508) have required it for longer, and customers increasingly ask for it. Check which rules apply to you.
Why it is hard in .NET, and what Tagua does
Section titled “Why it is hard in .NET, and what Tagua does”Most PDF libraries draw text and lines at positions, and tagging is left to you: every paragraph, heading and table cell has to be wrapped in the right structure element, in reading order, by hand. Report writers mostly produce untagged PDFs. So accessible documents usually need a separate remediation step.
Tagua tags every document by default, from the template:
- Text is a paragraph (
P);tag: h1toh6makes it a heading. Headings must start ath1and not skip levels. - Tables become real tables: header cells (
TH) with their scope, rows and data cells, even across pages. - Images and barcodes are figures with the alternative text you give in
alt. - Page headers and footers, and anything you mark
tag: artifact, are kept out of the reading order. - Links are tagged as links, with their target described for assistive technology, and the document has a title and a language.
With compliance: [pdf-ua-1], Tagua checks the template for what PDF/UA requires before any data is read: a title,
a language, alternative text for every image, embedded fonts and headings in order. A mistake is an error with its
location, not a document that fails later.
An example
Section titled “An example”This report is PDF/UA-1. It passes veraPDF, the reference validator, and you can download the PDF to try it with a screen reader.
# An accessible report (PDF/UA-1): a title and a language, headings in order, a table with header cells, alternative# text for the image, a decorative rule kept out of the reading order, and a link.title: Accessibility review, third quarterlanguage: en-GBculture: en-GB
document: author: Contoso Ltd compliance: [pdf-ua-1]
fonts: Inter: { regular: fonts/Inter-Regular.ttf, bold: fonts/Inter-Bold.ttf }
styles: default: { font: Inter, fontSize: 10pt, lineHeight: 1.4 } th: { fontWeight: bold, borderBottom: "0.75pt solid #3E2A1A", padding: 0 0 3pt 0 }
data: services: { fields: { Service: string, Documents: int32, Passed: int32 } }
body: reportHeader: - gap: 8pt content: - { type: image, source: banner.png, width: 180pt, alt: "Tagua: accessible, archival PDF reports for .NET" } - { type: text, value: "Accessibility review, third quarter", fontSize: 18pt, fontWeight: bold, tag: h1 } - type: text value: >- Every document our services produced this quarter was checked against PDF/UA. This table shows how many passed, by service. - { type: text, value: Results by service, fontSize: 13pt, fontWeight: bold, tag: h2 } - type: table dataset: services headerStyle: th columns: - { header: Service, value: "{Service}", width: 3fr } - { header: Documents, value: "{Documents:N0}", width: 1fr, align: end } - { header: Passed, value: "{Passed:N0}", width: 1fr, align: end } - { header: Rate, value: "{Passed / Documents:P0}", width: 1fr, align: end } footer: - cells: - { value: Total, isHeader: true, fontWeight: bold } - { value: "{Sum(Documents):N0}", align: end, fontWeight: bold } - { value: "{Sum(Passed):N0}", align: end, fontWeight: bold } - { value: "{Sum(Passed) / Sum(Documents):P0}", align: end, fontWeight: bold } - { type: line, stroke: "0.5pt solid #A3968A", tag: artifact } - type: text value: How the documents are checked is explained at taguareports.com. link: https://taguareports.com
pageFooter: - content: - { type: text, value: "Page {PageNumber} of {TotalPages}", fontSize: 8pt, align: end }data: services: - { Service: Invoicing, Documents: 18240, Passed: 18240 } - { Service: Statements, Documents: 9120, Passed: 9054 } - { Service: Letters, Documents: 2305, Passed: 2251 }
What makes it accessible:
titleandlanguage(en-GB): the title is shown in the viewer’s title bar and read first; the language tells a screen reader how to pronounce the text. An element in another language takes its ownlanguage.tag: h1andtag: h2give the document an outline that screen readers navigate by.- The table’s header row becomes
THcells, andisHeader: truemakes the footer’s “Total” a row header, so each number is read with its column and row. altdescribes the image. A decorative image would betag: artifactinstead.- The rule under the table is
tag: artifact: it is decoration, not content. - The fonts are embedded (
fonts), so the text can be extracted exactly, which PDF/UA requires.
Render it from C# like any other report (see your first report), or with
tagua render accessible-report.report.yaml.
PDF/UA-1 or PDF/UA-2
Section titled “PDF/UA-1 or PDF/UA-2”pdf-ua-1 (2014) is what most checkers and procurement requirements ask for today. pdf-ua-2 (2024) is based on
PDF 2.0; Tagua writes a PDF 2.0 file for it, and it combines with pdf-a-4 or pdf-a-4f rather than PDF/A-2 or
PDF/A-3. Accessibility and archiving combine well: compliance: [pdf-a-2b, pdf-ua-1] gives a document that is both.
See PDF/A in .NET.
Accessible PDFs from RDLC reports
Section titled “Accessible PDFs from RDLC reports”Moving reports off ReportViewer is a chance to make their PDFs accessible in the same step. Convert them with tagua import: the template it writes has a title (the report’s
name), the report’s language when the RDLC sets one, and the images’ tooltips as their alternative text. Then
declare PDF/UA in it:
document: { compliance: [pdf-ua-1] }Tagua checks the template before rendering, and lists what the standard needs, with each place. For a typical report, what is left is the language, which most RDLC files do not set, and the fonts:
error language: PDF/UA requires the document language.error styles.default.font: 'Arial' is a non-embedded standard font; PDF/A and PDF/UA require embedded fonts. Declare a font under fonts.Give the language, and declare the fonts the report uses, once: every text box that names them embeds them. Liberation Sans has the metrics of Arial, so text wraps as it did:
language: en-USfonts: Arial: regular: fonts/LiberationSans-Regular.ttf bold: fonts/LiberationSans-Bold.ttfThe sales invoice of the migration examples, which sets its language, passes
veraPDF’s PDF/UA-1 checks with the compliance and the fonts added. Two more lines make it a better document for the people who read it with a screen reader: the
title becomes a heading (tag: h1), and the logo, which has no tooltip in the RDLC and so was converted as
decoration (tag: artifact), gets its description (alt: Alder & Finch, home supplies).
Checking the result
Section titled “Checking the result”-
Validate it with veraPDF, which checks the machine-checkable rules of PDF/UA:
Terminal window verapdf -f ua1 accessible-report.pdfTagua’s own tests run veraPDF on every sample on every change.
-
Check it with PAC, the free PDF Accessibility Checker, which also shows the structure tree and a screen reader preview.
-
Listen to it with a screen reader: NVDA on Windows, VoiceOver on macOS. Validators check the rules; only a person can tell whether the alternative text is useful and the reading order makes sense.
- The template reference documents
tag,altandlanguageon every element. - Factur-X invoices are PDF/A-3 and PDF/UA-1 at the same time.