Determinism over prompting
Free-form generation drifts. A fixed pipeline with a reviewed content file does not.
A production pipeline for bringing legacy brochures into a new house style, with accessibility and content fidelity built into the process. AI interprets the source. People review the decisions. Scripts build and check the output.
Large organisations sit on hundreds of documents in a house style that has since moved on. Restyling them is manual DTP work: slow, expensive, and no two conversions come out quite the same. Accessibility is usually bolted on afterwards, if at all. And when someone retypes text into a new layout, wording changes without anyone noticing.
The model does the parts that need judgment: reading the structure of a messy source, deciding what is a callout and what is a caption, spotting a wrong cross-reference. Everything else — layout, pagination, tagging and checking — is deterministic code. That gives one rule that holds the whole system together: same input, same output.
Reproducibility starts with the reviewed content file, config, design tokens and a fixed pipeline. Model interpretation is reviewed before that build input is locked.
The source PDF is analysed: fonts, sizes and colours become a style map — heading, lead, callout, table, footer. Hidden text and low-resolution images are flagged.
A human sees the structure, the doubtful cases and the expected deviations before anything is built.
Content is written to a plain-text content file. A reviewer fixes cross-references, merges split paragraphs, writes alt text, and logs every textual correction.
One pipeline renders HTML, prints the PDF, and post-processes it to PDF/UA.
Automated accessibility and fidelity checks. If a hard gate fails, nothing ships.
Output, edit log and QA report go to a DTP specialist and the content owner. Content issues are reported, never silently corrected.
| Layer | What it does |
|---|---|
| Orchestration | A Claude skill: instructions and scripts. Three workflows: legacy PDF, new Word text with images, and legacy PDF with reviewer comments. |
| Extraction | PyMuPDF reads text spans with font, size and colour. A style profiler maps them to roles and writes a reviewable style file. |
| Content model | A small markup language (content.md) plus a JSON config. Blocks for chapter openers, callouts by function — tip, caution, info, question — quotes with photo, tables, figures with alt text, and columns. |
| Design tokens | Colours, type sizes, leading, tints and radii are generated from the designers’ InDesign (IDML) template into tokens.css. Never edited by hand. A palette report flags off-palette colours and conflicting styles between documents. |
| Rendering | HTML/CSS template, printed to PDF by headless Chromium (Playwright). Custom pagination rules: measured fit for one-page chapters, column balancing, 10 mm print margins, and an approximated 7 pt baseline grid. Figtree and a custom headline face as WOFF2. |
| PDF/UA post-processing | pikepdf: untagged content — backgrounds, decoration, icons, running footers — marked as Artifacts; link annotations get descriptions; XMP metadata with title, language and pdfuaid:part=1; MarkInfo and DisplayDocTitle; bookmarks rebuilt from the headings. |
| Accessibility gates | PDF/UA-1 machine checks on Matterhorn conditions, calibrated against PAC. axe-core (WCAG 2.2 AA) and HTML_CodeSniffer at 1280 px and 320 px. No horizontal scrolling. |
| Fidelity gate | Word-for-word diff between source and output using Python difflib. Every difference has to be explained in the edit log. |
| Regression | Five reference cases, including conversions compared against designer-made PDFs. Thresholds on word identity and baseline deviation. Nothing in the template changes without a green run. |
| Outputs | HTML, PDF/UA, edit log with QA report, plus the reviewed content file and config, so a rerun gives the identical result. |
Free-form generation drifts. A fixed pipeline with a reviewed content file does not.
The tool never rewrites. Inconsistencies, broken links and style problems go on a list for the content owner.
The design lives in InDesign. The tool reads it instead of copying it, so a house-style update becomes “update tokens, rerun regression” rather than “redo every document”.
Plan approval before building, review before output, a DTP specialist at the end.
A failed hard gate stops the run.
Reported results from the project’s five reference cases. These describe the tested set, rather than a guarantee for every source document.