Test PDF rendering changes across two Poppler builds
21 May 2025
To test a PDF renderer update, render the same file with both builds at the same resolution. Compare the whole page, then inspect regions where a single character matters. In the example below, two Poppler builds produced identical pixels on a synthetic page. Changing one digit in the input exposed a difference that the page-wide threshold missed.
Related articles
- Set thresholds for visual PDF regression tests
- Distinguish antialiasing changes from rendering defects
- Record approved exceptions in visual regression tests
- Rebaseline outputs after an intentional design change
Which differences would change this page’s meaning?
The release owner needs to know whether a proposed update changes layout, fonts or visible page content in ways that harm required tasks. Define which output is being assessed: on-screen rendering, a generated image, a print path or an exported PDF. Evidence from one route should not be silently transferred to another.
Choose documents with stable reference outputs and known business importance. Include small text, tables, rotated content, annotations and required scripts or languages where relevant. The test should retain enough information to distinguish a renderer change from a changed input, missing font or altered setting.
Where this guidance stops
This process detects visual changes associated with controlled releases. It does not compare the business meaning of deliberately revised documents or prove that signatures, attachments and interactive fields remain valid. Those require separate checks. The example uses two tests. One compares identical input across two builds. The other deliberately changes a digit in the source to check whether the detector can catch it.
Build baseline documents and renders
Stable environment, fonts and render settings
Freeze each source PDF and calculate its checksum. Record the renderer name and version, operating environment, available fonts, resolution, colour space, page geometry and annotation settings. Use the same conditions on both sides except for the change under evaluation. Retain a known-good build so a disputed result can be reproduced.
PyMuPDF's image documentation describes page rendering and explicit resolution settings. Its page API exposes controls for colour space, clipping, alpha and annotations. These settings are part of the test specification, not incidental implementation detail.
Render the baseline twice before comparing releases. An unstable baseline makes later differences difficult to attribute. Check page counts and image dimensions first; a missing page or changed crop should not disappear inside an image-normalisation step.
Maintain a small table for each test route:
| Item | Evidence to freeze |
|---|---|
| Input | Source ID, checksum, page count and permitted use |
| Renderer | Exact build and relevant configuration |
| Environment | Fonts, platform and output settings |
| Reference | Approved images and critical content regions |
| Comparison | Difference method, thresholds and review rules |
| Decision | Named reviewer, defects and accepted exceptions |
For a genuine update test, render the identical input bytes through the old and candidate builds. If other variables must change, record them and use additional controlled runs to isolate their effects.
Two renderer builds and one deliberately changed amount
Inputs, assumptions and the expected result
The supplied baseline PDF is a one-page original synthetic fixture displaying an illustrative amount of 137.50. A second injected-fault PDF changes that amount to 187.50. Everything else was generated using the same layout instructions. These are invented values, not financial records.
Python 3.12.14, ReportLab 4.4.9 and PyMuPDF 1.26.6 produced and rendered the files. Both renders used 144 dpi, RGB, a non-transparent background and annotations enabled. Each image measured 1,191 by 1,684 pixels, or 2,005,644 pixels. A repeated render of the unchanged baseline produced zero changed pixels.
The comparison counted a pixel when the largest absolute difference between its RGB channels exceeded 16 on a 0–255 scale. This illustrative channel tolerance left 289 changed pixels, all inside the declared amount-row region. Without that tolerance, 333 pixels differed at all.
| Check | Observed result |
|---|---|
| Significant changed pixels | 289 |
| Significant share of the page | 0.0144% |
| Significant pixels in the critical region | 289 |
| Illustrative 0.1% page-only gate triggered | No |
| Any-significant-change rule in the critical region triggered | Yes |
The saved results retain the exact dimensions, settings, region coordinates and file hashes. The difference image locates the changed digit. The important result is that a consequential change can occupy too little of the page to trigger a broad percentage gate.
What the results establish
An independent run used Poppler 26.01.0 and 26.05.0. Each rendered the identical baseline PDF at 144 dpi on the same machine. Both repeat renders were stable, and the two builds produced zero pixel differences on that page. When each build rendered the changed input, 290 pixels exceeded the channel tolerance, all within the amount row. The cross-build results separate the unchanged-input test from the deliberately altered input.
The difference of one pixel between Poppler’s count and PyMuPDF’s illustrates why the renderer belongs in the test record. This single page supplies no estimate of detection rates on business documents. Approve a tolerance with the people who rely on the output, using document families and known faults from their work.
Separate defects from harmless changes
Thresholds, antialiasing and material content loss
Treat page-wide scores as triage information. Small changes around character edges may arise from rendering differences, while a single altered digit can change the meaning of a document. Location and task consequence matter alongside the number of pixels affected.
Use two complementary review paths. Page-wide comparison finds unexpected layout movement, missing images and broad changes. Critical-region checks focus attention on amounts, identifiers, warnings and other content whose alteration has disproportionate impact. Define those regions from document requirements, not by looking only where a candidate happened to fail.
Calibrate tolerances with known-good repeats and labelled faults. Include missing characters, clipped rows, incorrect page rotation and displaced content. Keep the expected detection result for each fault so a later threshold adjustment can be assessed for both reduced noise and newly missed errors.
Avoid automatically aligning, cropping or smoothing images until meaningful defects vanish. If alignment is necessary, retain both the raw and transformed comparisons and explain what the transformation can conceal. A moved signature block or truncated footer may itself be the defect.
Have reviewers inspect the source, baseline and candidate together. Record whether a difference is material, acceptable or unresolved, and why. A visual match should never be used as evidence that hidden document structures survived; appearance is the specific outcome this test measures.
Acceptance checklist for PDF rendering regression testing
Root cause, exclusions and release blockers
When a difference appears, first verify source checksums, page geometry and render settings. Then check the font environment and repeat the run. If the result persists, compare the same source under the previous build. This sequence narrows the cause without assuming every changed image is a software defect.
Use a release checklist with explicit evidence:
- Every required source page has a candidate render and comparable baseline.
- Input bytes and environmental differences are documented.
- Known injected faults still trigger the intended checks.
- Critical content regions have no unexplained material changes.
- Visual exceptions have a named reviewer and a stated business effect.
- Unresolved failures are linked to affected document types and workflows.
- The previous validated route remains available if release must be reversed.
Block release for unexplained content loss, unreadable required text or an incorrect critical value. A harmless appearance change may be accepted when its scope and reasoning are recorded. An excluded document family needs a working route and ownership; removing its failing cases from the report does not resolve the risk.
Keep baseline approval separate from candidate testing. Automatically replacing the reference with the latest output would erase the evidence needed to challenge a regression.
Release with documented visual evidence
Reviewed exceptions and ongoing baseline control
The release record should link the software build, corpus version, comparison results, investigated defects and accepted exceptions. Preserve baseline and candidate images so later incidents can be compared with the exact approved state. If a reference changes, explain whether the cause was an intentional design update, a corrected baseline or an accepted rendering difference.
Monitor new document generators, fonts and layouts after release. Add representative failures to the regression corpus with clear reference expectations. Re-run affected cases when the rendering engine or its environment changes, rather than assuming the last approval covers every future configuration.
The supplied fault fixture is a useful initial check that your comparison process can notice a small but important change. The next step is a controlled old-build versus candidate-build run on identical authorised documents, followed by review of the actual differences before approving deployment.
Set thresholds for visual PDF regression tests
Compare a harmless rendering difference and a consequential digit change before selecting a visual threshold for the workflow.
Read “Set thresholds for visual PDF regression tests”.
Distinguish antialiasing changes from rendering defects
Inspect the affected glyph and surrounding field to distinguish a small antialiasing difference from a changed number.
Read “Distinguish antialiasing changes from rendering defects”.
Record approved exceptions in visual regression tests
Limit an accepted visual exception to the reviewed region and conditions, recording when it should expire or be reviewed again.
Read “Record approved exceptions in visual regression tests”.
Rebaseline outputs after an intentional design change
After an intentional layout change, verify the moved element and an unchanged control before accepting a new rendering baseline.
Read “Rebaseline outputs after an intentional design change”.
Sources
Published by Arke Technologies (Pty) Ltd, Johannesburg. Drafted with ChatGPT. Editorial and technical checks by Kairos (Codex). The linked articles were drafted with NotebookLM and independently checked and edited by Kairos (Codex).
