Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Documentation

- **Where the conformance rules knowingly disagree with veraPDF is written down (#418, #419).**
`docs/conformance-divergences.md` records five cases, each with what the standard requires, what an
independent second reading found, what veraPDF does, which one this library follows, and whether a
reader with only this repository can confirm it. Two are inherited from the profile and are gated
behind the per-rule comparison, since correcting them makes this library disagree with veraPDF and
the id diff currently fails in both directions. One is the reverse case, where this library is
stricter than both the standard and the profile. The file exists because a diff that treats
profile membership as the passing condition makes the profile authoritative by construction, and
because a diff between two implementations cannot surface a requirement both omit: 19 of the 73
file-scoped clauses in the archival standard are checked by neither, seven of them at the
accessibility level this library advertises.

- **Measured behaviour of two candidate differential oracles, Ghostscript and MuPDF (#420).**
`docs/differential-oracles.md` records what each one actually does, run against five fixtures on
WSL Ubuntu 24.04, and `eng/oracles/install-oracles.sh` builds both from pinned upstream sources
Expand Down
13 changes: 11 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ example US 5,591,956 for Aztec Code). A reference decoder, zxing-cpp, is used
only as an interoperability cross-check in the test suite, never as a source
of implementation; this includes verifying the exact Aztec module-placement
coordinates, since the relevant ISO/IEC 24778 figures are not freely
available. No source code is copied from, and this product is not derived
from, any third-party PDF or barcode library.
available. A conformance validator, veraPDF, is used as a test oracle in the
same way; unlike zxing-cpp it is also, for now, a source of implementation,
because where a standard this project validates against was not held at the
time its rules were written, the conformance rules citing that standard were
authored from veraPDF's published validation profiles rather than from the
standard's own text. That applies to ISO 19005-2 (PDF/A-2), which is still not
held, and to ISO 14289-1 (PDF/UA-1), which was acquired only after its rules
were written. Holding a standard does not re-author the rules that predate it,
so both sets are still to be re-derived; that work is tracked as issues #418
and #428. Beyond that, no source code is copied from, and this product is not
derived from, any third-party PDF or barcode library.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
the files in this repository except in compliance with the License. A copy of
Expand Down
192 changes: 192 additions & 0 deletions docs/conformance-divergences.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# Where the conformance rules disagree with veraPDF, and why

`VellumPdf.Conformance` is the authoritative normative implementation. veraPDF is an oracle: its
output is evidence, not a verdict. Where the two disagree, the specification decides.

That principle needs somewhere to write the disagreements down, because the test suite currently
does the opposite. `ConformanceCatalogTests.Catalog_MatchesVeraPdfProfile` set-diffs our rule ids
against veraPDF's profile ids and fails in **both** directions, so a rule the standard requires and
the profile omits breaks the build exactly as a phantom rule would. Agreement with the tool is the
passing condition, which makes the profile authoritative by construction.

This file is the intended replacement for that posture. A disagreement recorded here is known and
accepted. A disagreement that appears and is not here is what should fail.

## How to read a row

Each row says what the standard requires, what any independent second reading found, what veraPDF
does, which one this library follows, and why. The Checkable field is the one that is easy to
skip and shouldn't be: it says whether a reader with only this repository can confirm the row, or
whether it rests on a document nobody here holds.

Two rows are **gated**. Correcting them makes this library disagree with veraPDF on a profile, which
fails the aggregate oracle and the id diff as they stand today. Those corrections wait for the
per-rule comparison in #419. The others are not gated, because fixing them moves toward the tool
rather than away from it.

---

## D1 — CIDSystemInfo `Supplement` compared in the wrong direction

- Rules: `FontStructureRule.CheckCidSystemInfo`, `UaCidSystemInfoRule`
- Clauses: ISO 19005-2 6.2.11.3.1, ISO 14289-1 7.21.3.1
- Status: gated on #419 · tracked in #428

The standard requires the CIDFont's `Supplement` to be **greater than or equal to** the CMap's. The
clause's own NOTE gives the reason: the font must contain glyphs for every CID the CMap can
reference. veraPDF tests the opposite, `CIDFontSupplement <= CMapSupplement`, in both `PDFUA-1.xml`
and `PDFA-2B.xml`, and both profile descriptions quote the clause as "less than or equal to". This
library matches veraPDF.

**Second reading.** Two standards say it independently. ISO 32000-1 Table 116 adds that `Supplement`
"shall not be used in determining compatibility between character collections" at all, so the base
specification imposes no direction and cannot be the source of the inverted one.

**Why it is wrong the way it is.** veraPDF's direction requires the font to be older than the CMap,
which defeats the purpose the NOTE states.

Checkable: ISO 14289-1 and the profile XML are both here, so the PDF/UA-1 half is confirmable
from a clone. The ISO 19005-2 half was read through a licensed viewer and is not.

## D2 — An Identity exemption keyed on the wrong thing

- Rules: `FontStructureRule.CheckCidSystemInfo`, `UaCidSystemInfoRule`
- Clauses: ISO 19005-2 6.2.11.3.1 and 6.2.11.3.3, ISO 14289-1 7.21.3.1 and 7.21.3.3
- Status: gated on #419 · tracked in #428

The standard grants one exemption, keyed on the `/Encoding` entry of the Type 0 font dictionary
being `Identity-H` or `Identity-V`. Both rules implement that correctly and then add a second
exemption keyed on something else: an embedded CMap stream whose own `/CMapName` is one of those
names. Those are different populations. When `/Encoding` is a stream rather than a name, the
standard's exemption does not apply whatever the stream calls itself.

`FontStructureRule` says where the second one came from, unprompted:

> An embedded CMap whose own /CMapName is Identity-H/V is exempt too — veraPDF keys the exemption
> on the CMap name, not the /Encoding reference

**Second reading.** `CMapName` occurs zero times in ISO 14289-1 and zero times in ISO 19005-2, the
latter validated against a control term returning seven hits so the zero means something. Neither
CMap clause licenses it.

**Why this one matters more than D1.** It fails in the direction that stays quiet. An over-broad
exemption suppresses a finding the standard wants raised, so a non-conformant file passes and
nothing announces it. D1 at least fires.

Checkable: the PDF/UA-1 half, yes. The PDF/A-2 half rests on the viewer.

## D3 — An allow-list described as what the clause says

- Rule: `ActionRule`
- Clauses: ISO 19005-2 6.5.1, with 5.1
- Status: not gated · prose only

The clause is written as three prohibitions, and 5.1 permits anything not explicitly forbidden.
veraPDF quotes that deny-list sentence verbatim as its description and then tests an allow-list of
seven action types. `ActionRule` implements the allow-list and its remarks assert "The clause is an
allow-list", which describes veraPDF's test rather than the clause.

**Second reading.** Subtracting the forbidden types from the set ISO 32000-1 12.6.4 defines leaves
exactly the seven the rule permits, so the two formulations coincide for defined types and part
company only for undefined or vendor ones — which the rule's own comment says it means to reject.

**Why it is here anyway.** The behaviour is defensible; the sentence is not, and it sits under a
clean-room remark claiming derivation from the specification text. This is the third rule where the
profile's framing survived into our prose, after D1 and D2, and none of the three was found by a
test, because in each case the behaviour and the description diverged rather than the behaviour and
the tool.

Checkable: the ISO 32000-1 arithmetic is, from the held copy. The ISO 19005-2 clause structure is
not.

## D4 — Font embedding ignores the rendering-mode-3 exemption

- Rule: `FontEmbeddingRule`
- Clause: ISO 19005-2 6.2.11.4.1
- Status: not gated

The clause scopes embedding to fonts "used for rendering", and its NOTE 2 exempts a font referenced
solely in text rendering mode 3, which is invisible. veraPDF exempts it too. This library exempts
nothing: `FontEmbeddingRule` enumerates through `PreflightContext.EnumerateUsedFonts()`, and that
set is populated in `ContentStreamUsage` on the `Tf` operator alone, with no reference to the
rendering mode the same pass already tracks.

**Why it is the odd row.** This is not inherited from anywhere. It is the one divergence where this
library is stricter than the standard *and* stricter than the profile at the same time, so
correcting it moves toward both.

**The correct pattern already exists in the tree twice.** `UaFontEmbeddingRule` walks
`usage.TextShows` and requires a positively determined mode other than 3, and it settles the
parse-gap case where the mode could not be determined. `GlyphPresenceRule` carries the same
exemption.

**Practical effect.** A scanned page with an invisible OCR text layer selects a font and draws it in
mode 3, so this rule demands embedding for a font the standard exempts. That is the commonest
mode-3 case in the wild.

Checkable: the code half, yes. The clause and its NOTE rest on the viewer.

## D5 — A correct severity with the wrong justification

- Rule: `A2aContentItemTaggingRule`, via `RuleRegistry`
- Clause: ISO 19005-2 6.7.3.3
- Status: not gated · reasoning only

The clause carries one requirement, that the structure hierarchy be rooted in `StructTreeRoot`, and
one recommendation, that a writer capture it to the finest granularity available. Nothing requires
every content item to be described. This library reports a warning, which is right.

The justification is not. `RuleRegistry` says:

> Warning, not error: veraPDF's PDF/A-2a profile implements no equivalent, so an error here would
> contradict the reference implementation.

The severity is derived from tool agreement, and veraPDF is called the reference implementation. The
real reason is that the clause states a recommendation rather than a requirement. Nothing behavioural
changes; the sentence does.

Checkable: the registry comment, yes. The clause is the viewer's.

---

## Clauses neither implementation checks

These are not disagreements and do not belong in the table above, but they are the reason the table
alone is not enough. A diff between two implementations cannot surface a requirement both of them
omit, because they agree.

Measured against an inventory of ISO 19005-2 clause 6 by number and heading, 19 of its 73
file-scoped clauses are checked by neither this library nor veraPDF. That inventory and the script
that reports the split are being added under #418; until they land, the figures here are a snapshot
rather than something a clone can recompute.

Seven of the 19 are Level A only, and Level A is the accessibility level this library advertises:

- 6.7.2.1 Tagged PDF, general
- 6.7.3.1 Specification of artefacts
- 6.7.3.2 Word boundaries
- 6.7.5 Alternate descriptions
- 6.7.6 Non-textual annotations
- 6.7.7 Replacement text
- 6.7.8 Expansions of abbreviations and acronyms

Two cautions carry with that number. Entries titled "General" may be introductory rather than
independently checkable, and the detection is deliberately generous, crediting a rule that cites a
parent clause. So 19 is a floor on the coverage gap rather than a count of defects.

One clause sits in both places. **6.6.5, File identifiers**, is checked here and by no veraPDF rule,
so under the current two-directional diff being right registers as a phantom id.

## Adding and removing rows

A row goes in when a disagreement is established against the specification, not when it is suspected.
State which reading established it and whether a clone can confirm it.

Record the verdict, not the argument that produced it. "Matches 6.2.11.4.1" is a verdict; working
through why it matches, clause by clause, would restate the standard through the side door. The
"what the standard requires" sentence in each row above is one sentence per divergence, which is
quotation-scale; a document of them would not be.

A row comes out when the code and the tool agree again, which for the gated rows means after the
per-rule comparison lands and the correction is made. Removing a row is a claim that the divergence
is gone, so it belongs in the same commit as the change that closes it.
2 changes: 2 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
href: pdf20-conformance.md
- name: Differential Oracles
href: differential-oracles.md
- name: Conformance Divergences
href: conformance-divergences.md