Skip to content

Deterministic pdf#523

Merged
SimonCropp merged 6 commits into
mainfrom
deterministic-pdf
Jul 23, 2026
Merged

Deterministic pdf#523
SimonCropp merged 6 commits into
mainfrom
deterministic-pdf

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

No description provided.

This is where the normalizer originated. It has since been extracted to the
DeterministicPdf package and adopted by the other pdf producing repos, so the
local copy is now the duplicate.

The algorithm is unchanged, which the unchanged pdf snapshots confirm. The
package additionally takes a defensive copy, so the caller keeps ownership of
the array it passed.

The tests that cover the algorithm itself now live in the package. The ones kept
here are the pdfium specific wiring: that a normalized document, a FOP produced
document, and a pdfium re-split page subset all still load.
Ports the SkipPdfNormalization setting from Verify.PDFium (3fd22e9).

Adds a SettingsTask/VerifySettings extension backed by a context key, so a caller
whose producer already emits byte-deterministic documents can snapshot the bytes
as produced. Normalizing those again copies the buffer, rescans it, and — when
the XMP packet is canonicalized — rebuilds it and repairs the cross-reference
table, all to change nothing.

Default behaviour is unchanged: without the setting the bytes are normalized.

SkipPdfNormalizationTests asserts the pairing rather than just that the setting
round-trips: the skipped snapshot holds the producer's own bytes and the default
one holds the neutralized bytes. A premise test pins that the sample is not
already normalization-invariant, so the pair cannot both pass vacuously.
@SimonCropp SimonCropp added this to the 3.5.0 milestone Jul 23, 2026
@SimonCropp
SimonCropp merged commit 35830c7 into main Jul 23, 2026
2 of 4 checks passed
@SimonCropp
SimonCropp deleted the deterministic-pdf branch July 23, 2026 09:45
@github-actions
github-actions Bot restored the deterministic-pdf branch July 23, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant