The original Word, XML or layout source has disappeared. The PDF still exists, looks fine and contains text, but has no useful structure for assistive technology. Can it be turned into PDF/UA automatically?
In an earlier article, we described the route: analyse, classify, reconstruct, regenerate and validate. The reconstruction core is now running. Its most important design decision turned out not to be a smarter auto-tagging algorithm, but a different starting point: treat the old PDF as measurable source material and build a new semantic document.
This is not a promise that any arbitrary PDF becomes accessible at the push of a button. It is a reproducible way to remediate families of similar, digitally-created documents, with checks for both PDF/UA conformance and content preservation.
Why tags added afterwards often rest on the wrong foundation
A PDF records exactly where letters, lines and images appear on a page. What those elements mean is often no longer available.
- Two text blocks side by side may be columns or a table.
- Bold text may be a heading or ordinary emphasis.
- A repeated logo may be page furniture, while a similar image carries content.
- A number to the left of text may be a list label, section number or table cell.
- The visible text of a link and its PDF annotation may live in different objects.
Auto-tagging has to infer meaning inside the existing PDF objects. If those objects do not follow the reading order or content structure, neat tags are attached to the wrong model. That is why we do not primarily repair the old file's structure tree. We read the file and create a new structure.

Four measurements create one source view
No single extractor contains all the information required. The reconstruction pipeline therefore reads four aspects of the same PDF:
- Text and coordinates: words, lines, blocks, columns and their bounding boxes.
- Typography: font family, size, weight and colour per text fragment.
- Drawn shapes: lines, borders and filled areas that may reveal a table or illustration.
- Annotations: external and internal links, their target, position and visible link text.
These signals are merged by coordinate into one intermediate model. Reading order and semantics are established only after that:
existing PDF
→ text + typography + shapes + annotations
→ reading order
→ headings, paragraphs, lists, tables, figures and links
→ semantic XSL-FO
→ new tagged PDF
The old PDF remains unchanged. The new PDF is a separate, fully rebuilt artefact.

Measure first; configure exceptions only
The scalable component is not “one universal rule for all PDFs”. It is the combination of generic measurements and a small configuration for each document family.
Page size, margins, columns, gutter, font size, line height, indentation and spacing are measured from the documents themselves. Outliers must not define the entire page layout; robust percentiles work better than a minimum or maximum.
A family configuration records only what geometry cannot determine reliably, such as:
- which typography and text patterns denote heading levels;
- which recurring image is a logo or other page furniture;
- when something that looks like a table is actually numbered running text;
- which description should be assigned to a recurring meaningful image.
Metadata from the source PDF automatically selects the appropriate family configuration. A new document family therefore starts with measurement, not a handwritten template full of fixed coordinates.

Columns are not tables
The hardest errors occur when geometry is mistaken for meaning. An earlier reconstruction attempt placed 96 percent of the running text in tables. Two page columns had been interpreted as table columns; a document of several dozen pages grew to 126 pages, sometimes with one word per line.
The new pipeline determines reading order first. Table detection happens only
afterwards and must find enough evidence for both rows and columns. Confirmed
tables are rebuilt with Table, TR, TH and TD, including explicit
relationships between data cells and their header cells. Text columns remain
ordinary text.
That distinction is essential: a table is not a visual arrangement, but a semantic relationship between cells.

Regeneration makes quality enforceable
XSLT turns the intermediate model into new XSL-FO. Apache FOP then generates a new PDF/UA-1 candidate containing, among other things:
- a logical structure tree and reading order;
- document language and title;
- real lists and tables;
- tagged links with descriptions;
- embedded fonts and reliable Unicode text;
- page furniture kept outside the content as artifacts.
The formatter, stylesheets, fonts, extractors and validator are pinned to fixed versions. A failed build preserves the XSL-FO and reports, so the same failure can be reproduced later.

What the current series test actually proves
A series of thirteen German government documents from one publication family was recognised automatically through metadata and rebuilt one document at a time. The regression test on 29 July 2026 produced the following results:
- 13 out of 13 new PDFs were technically intact according to
qpdf; - 146,393 out of 146,393 Unicode letters were preserved;
- the single unique external URI in the source series remained 1 → 1;
- 13 out of 13 new artefacts passed PDF/UA-1 with zero failed rules using
veraPDF 1.30.2 and the explicit
ua1profile; - the first and last source and result pages of all thirteen documents were rendered and reviewed visually.
The total page count changed from 114 to 104. That was not automatically a defect: reflow combined several short cover pages with the beginning of the content. “The same number of pages” is therefore not a universal quality measure. The full letter stream, links, semantic structure and visual usability are stronger controls.
This result proves the controlled series and the document constructs covered by the tests. It does not prove that every kind of PDF can already be processed automatically.

One green validator is not enough
The pipeline deliberately uses more than one quality gate:
- Form: veraPDF checks the machine-verifiable PDF/UA-1 requirements.
- Content: the text stream and URIs are compared with the source.
- Integrity:
qpdfverifies that the new file is technically valid. - Appearance: representative pages are rendered and inspected.
- Human review: meaningful alternative text, complex reading order and semantic decisions remain review points where necessary.
The second gate is not theoretical. During development, a PDF passed formal PDF/UA validation while a large part of its text was missing. Conformance of the file structure and preservation of the publication are two different questions.
veraPDF itself states that its PDF/UA validation performs only
machine-verifiable checks. A green ua1 report should therefore be presented
as technical conformance evidence for that exact file, not as a complete user
test or general legal approval.

Where automation does and does not fit
This approach is well suited to digitally-created PDFs with a text layer, recognisable document families and recurring design. One tested family configuration can then serve many documents, and every subsequent change can be checked against the same regression contract.
Scans without a reliable text layer, forms, infographics, complex mathematics and documents whose meaning is known only to the author require additional extraction or human decisions. Alternative text cannot responsibly be derived from geometry alone either.
A project therefore starts with a representative corpus, not a bulk promise:
- identify document families and exceptions;
- measure source quality and extractability;
- agree acceptance criteria for content, structure and appearance;
- reconstruct one family end to end;
- make human review points explicit;
- scale only after the regression set is green.
This turns existing-PDF remediation from an opaque conversion into a repeatable production process with evidence for every file.

Sources and limitations
The test results above apply to the artefacts checked on 29 July 2026 and the
document constructs covered by those tests. PDF/UA conformance is claimed only
for an artefact with a successful veraPDF ua1 report; human accessibility
review remains necessary where the standard requires a content judgement.
