Skip to content

Add option to skip pdf byte normalization#863

Merged
SimonCropp merged 1 commit into
mainfrom
skip-pdf-normalization
Jul 23, 2026
Merged

Add option to skip pdf byte normalization#863
SimonCropp merged 1 commit into
mainfrom
skip-pdf-normalization

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

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.

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.10.0 milestone Jul 23, 2026
@SimonCropp
SimonCropp merged commit 4b63ece into main Jul 23, 2026
3 of 4 checks passed
@SimonCropp
SimonCropp deleted the skip-pdf-normalization branch July 23, 2026 09:56
@github-actions
github-actions Bot restored the skip-pdf-normalization branch July 23, 2026 09:56
@SimonCropp
SimonCropp deleted the skip-pdf-normalization branch July 23, 2026 09:57
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