Repository navigation
Description
Maintainer decision, 2026-11-18: "Version 3.0 should be very strict." Input and files that do not
comply with the ISO PDF rules are refused. This issue is the umbrella for that rule. It does not
replace the issues below; it says what each one covers and what is left over.
Why
The maintainer gave two reasons on 2026-11-18:
- Strict output: what the library writes complies with the ISO rules.
- A smaller attack surface on the read side. A reader that refuses non-compliant files by default
does not run its tolerance paths on hostile input unless the caller opts into repair.
#610 is the measured example of what a tolerance path costs on crafted input. On origin/main
1c61fa6, PdfReader.Open with AllowReconstruction = true on a 4 KiB run of [ allocated
293,244,376 bytes, against 952 bytes with reconstruction off. Both calls threw
InvalidDataException. That is one input on one path; it is not a measurement of the security
benefit of a strict default.
The rule
Refuse at the earliest point the library can name the defect:
| Where | What is checked | When it throws |
|---|---|---|
| Writer input | A value or combination a caller sets that the rules do not allow | At the call or property that takes it, not at the later Save |
| Written output | A document that would claim or contain something it does not meet | At Save, before anything is written to the stream |
| Read files | A file that does not comply | At Open, naming the clause |
The 2.x line, so 3.0 has something to turn on
2.x follows "valid file = keep" (#484's contract): any input for which 2.x writes a valid PDF keeps
saving, even when content is lost or misplaced. Three examples from PR #571's review, measured on
main 1c61fa6 (2.3.3 plus dependency updates): a table with an infinite top margin is not drawn, text
runs below the page when the available height is infinite, and a JBIG2 image with an unknown-length
segment embeds blank.
Each such kept input carries a "Do not pass ..." XML-doc paragraph that names 3.0. That paragraph is
the marker this issue collects. In 3.0 each one becomes a refusal.
How the related issues fit
- Refuse the input 2.3.x only reports: the contract changes a patch cannot make #484 (Layout input). Lists the Layout inputs that 2.x accepts and 3.0 refuses. It stays the
list for Layout writer input. This issue extends the same rule to the other packages and to the
Reader. - Conformance: a PDF/A or PDF/UA claim is stamped on a document the library's own preflight rejects #474 (a conformance claim the document fails). Covers a PDF/A or PDF/UA claim stamped on a
document that does not meet it. It is one case of written output atSave. Its comments say a
hard refusal atSavewould remove the failing-preflight demonstration that VellumPdfShowcase
relies on. This issue does not decide that; see the open questions. - Layout: one diagnostics channel, before a third one-off warning type is invented #496 (one channel). Unifies
Document.TextEncodingWarningsandDocument.BandTruncations
with the new channel. This issue needs that channel to exist but does not design it. - Layout: build-time accessibility diagnostics, with a strict mode #304 (Layout collect-and-report). Describes accessibility diagnostics collected during layout,
with a strict mode that names the clause. Layout: one general diagnostics channel and an opt-in strict mode (the additive half of #496 and the channel of #304) #607 delivers its channel and switch; Layout: build-time accessibility diagnostics, with a strict mode #304 keeps its
specific checks. - Layout: one general diagnostics channel and an opt-in strict mode (the additive half of #496 and the channel of #304) #607 (v2.4 bridge). Adds
Document.Diagnosticsand an opt-in strict switch, default off. It is
the route from 2.x to this issue: see below.
The bridge through #607
- Every input that 2.x keeps under "valid file = keep" gets its own diagnostic code in v2.4.
- Strict mode (opt-in in 2.x) refuses each of those codes.
- In 3.0 strict becomes the only behaviour, so the switch goes away and every code is a refusal.
What "ISO PDF rules" means here
- ISO 32000-1 and ISO 32000-2 for every file. Writer input, written output and read files are
all checked against them. Held copies are listed indocs/iso/ACQUISITION.md. Clause citations in
messages are checked against the text before they ship. - ISO 19005-x and ISO 14289-x when the document claims them. A claim that the document fails is
the Conformance: a PDF/A or PDF/UA claim is stamped on a document the library's own preflight rejects #474 case. ISO 19005-2 is not held locally (see PDF/A and PDF/UA-1 conformance rules are validated against veraPDF, not against the ISO text they cite #418), so any 19005 clause cited in a refusal
has to be read on NEN Connect first. ISO 14289-1 is held.
This says which standards bind which check. It adds no profile that #474 does not already name.
The Reader decision
In 3.0 the Reader is strict by default:
Openrefuses a file that does not comply and names the clause.AllowReconstructionand similar repair options remain explicit opt-ins.- A result that was repaired is reported as non-compliant, so a caller cannot take a repaired
document for a compliant one.
A strict default would refuse the [ file from #610 before reconstruction runs. A caller who opts
into AllowReconstruction still reaches the tolerance path, so it must stay bounded. #610 (v2.4)
is the issue for that.
The Reader package is still Preview and unshipped until #187 graduates it, so its surface can move
to carry this.
Open design questions
Not decided here:
- The exception type: one type for every refusal, or a hierarchy by where it is raised.
- How a clause is named: a structured property (standard, clause) alongside the message, or the
message alone. - How Conformance: a PDF/A or PDF/UA claim is stamped on a document the library's own preflight rejects #474's need to demonstrate a failing preflight verdict is met once
Saverefuses a failing
claim. - Whether a refusal at the property is possible everywhere, or whether some combinations can only be
checked atSave. - What the Reader's "non-compliant" report looks like on a repaired result.
Acceptance
- Every "Do not pass ... 3.0" paragraph in
srcbecomes a refusal with a test that asserts the
exception and its message, not only that something threw. The sweep greps the XML docs of all
eight packages. - Each diagnostic code added under Layout: one general diagnostics channel and an opt-in strict mode (the additive half of #496 and the channel of #304) #607 maps to one refusal, with a test.
- Reader refusals name the clause, with a test per refusal.
- The opt-in repair path reports non-compliance on its result, with a test.
PublicAPI.Unshipped.txtand the XML docs of each touched member are updated in the same commit,
per CLAUDE.md.
Activity
Tim81 commentedon Nov 18, 2026
Decided 2026-11-18 by the maintainer for the #474 showcase question above: preflight without a claim. In 3.0 the showcase keeps demonstrating a failing verdict by saving the document without the PDF/A or PDF/UA claim (or validating it in memory) and running
PdfPreflightagainst the target profile, so no file is written that claims a conformance it fails.Saverefuses a failing claim with no opt-out.The exception design (one type or a hierarchy, and how the clause is named) stays open until the 3.0 design work starts.
Tim81 commentedon Nov 27, 2026
The v2.4 slice for language values is #749: under PDF/A-2a and PDF/UA-1, Layout reports a value that is not a language tag as an Error so strict mode refuses; the default refusal stays here for 3.0.
Tim81 commentedon Nov 29, 2026
The ISO audit (
docs/conformance-v2.4.md) has skipped tests that wait on this issue; the fix removes their skip and makes them pass.Iso14289_1_7_2_LanguageThatIsNotATagIsNotWrittenUnderPdfUA1(group G5)Iso19005_2_6_7_4_LanguageThatIsNotATagIsNotWrittenUnderPdfA2a(group G5)