Skip to content

FOP-3322: Fix/pdfua internal link contents#102

Open
mgr34 wants to merge 2 commits into
apache:mainfrom
mgr34:fix/pdfua-internal-link-contents
Open

FOP-3322: Fix/pdfua internal link contents#102
mgr34 wants to merge 2 commits into
apache:mainfrom
mgr34:fix/pdfua-internal-link-contents

Conversation

@mgr34

@mgr34 mgr34 commented Jun 3, 2026

Copy link
Copy Markdown

Resolves FOP-3322 [0]. By setting the alt description written to the /Contents entry of the link annotation dict. PDF/UA-1 requires every link annotation to carry an alternate description.

Can verify result by running against the assets in FOP-3322.

fop -c fop.xml -fo minimal-links.fo -pdf output.pdf
verapdf --flavour ua1 --format xml output.pdf

Note

  1. verapdf is a product of the Open source industry supported PDF/A validation maintained by the Open Preservation Foundation [1]
  2. ISO 14289-1 can be downloaded at no cost from the PDF Associations website [2]

[0] https://issues.apache.org/jira/browse/FOP-3322
[1] https://github.com/verapdf
[2] https://pdfa.org/resource/iso-14289-pdfua/

mgr34 added 2 commits May 29, 2026 17:48
PDF/UA-1 (ISO 14289-1 §7.18.5) requires every link annotation to carry
an alternate description in its /Contents key. FOP set this only for
external (URI) links, where the alt text travels with the PDFUri action.
Internal (GoTo) links got /Alt on the Link structure element but no
/Contents on the annotation, so each one failed validation.

PDFDocumentNavigationHandler.renderLink now reads the alternate text back
from the Link structure element's /Alt (which already holds fox:alt-text)
and sets it on the PDFLink for both link types. PDFLink.toPDFString emits
/Contents from this explicit value when present, otherwise falling back to
the URI action's alt text as before.

Adds PDFLinkContentsTestCase covering internal links with and without an
alternate description, the external-link fallback, and explicit precedence.
@mgr34 mgr34 changed the title Fix/pdfua internal link contents FOP-3322: Fix/pdfua internal link contents Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant