Skip to content

Layout: a LinkUri link makes a PDF/UA-1 file fail ISO 14289-1 7.18.5 and 7.18.1 #550

Open

Description

@Tim81

A link written by Layout makes a PDF/UA-1 document non-conformant, and nothing reports it.

TextStyle.LinkUri and DrawContext.AddUriLinkAnnotation write a /Link annotation with a URI action and nothing else. The annotation has no /Contents and no /StructParent, and the structure tree has no Link element for it.

ISO 14289-1:2014, 7.18.5 says links "shall be tagged according to ISO 32000-1:2008, 14.8.4.4.2, Link Element" and "shall contain an alternate description via their Contents key". 7.18.1 says annotations "shall be represented in the structure tree in correct reading order".

Measured on docs/layout-xml-complete at f720527 with veraPDF 1.30.2 (--flavour ua1). The document has Conformance = PdfConformance.PdfUA1, Language = "en" and a title, and holds one paragraph in an embedded TrueType font:

  • without a link: PASS
  • with LinkUri = "https://a.example" on that paragraph: FAIL, rules 7.18.5-1, 7.18.5-2 and 7.18.1-2

A review lens also reported that the same link passes under PDF/A-2a and PDF/A-2b; I reproduced only the UA-1 result.

Document.Conformance already says that setting a level does not run the rules (#474), and #474 covers unembedded fonts. This is a second instance of that class. PR #542 documents it on TextStyle.LinkUri and DrawContext.AddUriLinkAnnotation; this issue is for the behaviour.

A fix would tag each link as a Link structure element holding an OBJR to the annotation, give the annotation a /StructParent, and write a /Contents alternate description. For LinkUri the linked text is an obvious default for /Contents, but choosing it is a design decision.

Activity

  1. added this to the v2.3.4 — Hardening milestone on Sep 18, 2026
  2. Tim81 commented on Nov 18, 2026

    @Tim81
    OwnerAuthor

    Acceptance for the pair, from the handbook research and the planning checks. Order: #569 first (it is the Kernel
    half), then #550. They are in different milestones today (#569 v2.4, #550 v2.3.9); both move to the v2.4 milestone.
    #569's work is #604 (mixed kids, OBJR, MCR, annotation ParentTree entries).

    Current behaviour (origin/main 1c61fa6): ParagraphRenderer.cs:307-311 and :358-363 call
    ctx.AddUriLinkAnnotation once per fragment, per line; DrawContext.cs:201-210 builds the annotation with Rect
    and Uri only; PdfLinkAnnotation.BuildDictionary (PdfLinkAnnotation.cs:41-81) writes Type, Subtype, Rect,
    Border, F and the action, with no Contents, no StructParent and no QuadPoints.

    Measured in the 2026-11-16 handbook research on VellumPdf 2.3.3: the link annotation had exactly those keys, the
    link text stayed inside the paragraph's single P marked-content sequence, and there was no Link element and no
    OBJR; veraPDF and the preflight both failed 7.18.5-1, 7.18.5-2 and 7.18.1-2.

    Acceptance:

  3. Tim81 commented on Nov 27, 2026

    @Tim81
    OwnerAuthor

    A requirement this issue's fix must meet, found in the v2.4 conformance audit (#739): when a tagged link's text wraps over several lines on one page, ISO 32000-1 14.8.4.4.2 (and ISO 32000-2 14.8.4.7.3 with its errata) asks for one Link annotation with /QuadPoints covering the pieces, not one annotation per line. Today Layout writes one annotation per line (the audit's 2a fixture has a long link as 27 annotations). That is harmless while no Link element is written, but tagging each of those annotations as it stands would break the clause. Across a page break one annotation per page is unavoidable, with their OBJRs kept in one Link element (Tagged PDF Best Practice Guide).

  4. Tim81 commented on Nov 29, 2026

    @Tim81
    OwnerAuthor

    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.

    • Iso19005_2_6_7_6_AnnotationsThatShowNoTextCarryContents (group G1)
    • Iso14289_1_7_18_5_LinksAreTaggedAsLinkElementsAndCarryContents (group G1)
    • Iso14289_1_7_18_5_ARunThatLinksIsATaggedLinkWithContents (group G3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions