Skip to content

Kernel: write a /Names name tree and the catalog /Names entry #241

Open

Description

@Tim81

The document catalog in this library never gets a /Names key. That single gap blocks three
separate features, so the name tree is the foundation the rest of v2.7 stands on.

Verified: searching the writer for Names finds only AcroForm field /T name strings and font
resource names (PdfDocument.cs:55-59, :399-491, :720) — nothing that writes a name tree.

What is blocked by it

Consumer Clause Issue
/EmbeddedFiles 7.11.4 A2 — attachments have nowhere to live
/Dests 12.3.2.3 B14 — named destinations
/PageLabels 12.4.2 B14 — and PDF/UA-2 §8.12.3 requires page labels when a page's number differs from its index
/JavaScript, /AP, /Templates, /IDS, /URLS, /Renditions 7.9.6 Table 33 not in scope, but the tree serves them

What to build

A balanced name tree per ISO 32000-2:2020, 7.9.6: /Kids for interior nodes, /Names for leaves,
/Limits on every node but the root, keys sorted by byte value. The sort is not cosmetic — a reader
is entitled to binary-search it, so an unsorted tree is silently wrong rather than merely untidy.

Worth deciding here rather than per-consumer: whether the tree is always written as a single leaf
below some size threshold. Small documents get a one-node tree either way, and a threshold keeps the
common case readable.

Acceptance

  • Trees of 1, 2, 100 and 10 000 entries all round-trip through VellumPdf.Reader.
  • /Limits correct at every level, verified against the actual key range of each subtree.
  • Keys sorted by byte value, including non-ASCII keys — a UTF-16 or culture-aware sort is a bug.
  • qpdf --check clean, and qpdf --json shows the tree structure the test expects.

Relates to


Plan labels used above, resolved: A2 #242 · B14 #262 · K2 #343.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions