You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Simon Steiner (Jira)" <ji...@apache.org> on 2026/10/22 17:47:00 UTC

[jira] [Commented] (FOP-3365) /StructureTreeRoot/ParentTreeNextKey is missing in accessible PDF output file

    [ https://issues.apache.org/jira/browse/FOP-3365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130453#comment-18130453 ] 

Simon Steiner commented on FOP-3365:
------------------------------------

ParentTreeNextKey is optional in pdf spec

> /StructureTreeRoot/ParentTreeNextKey is missing in accessible PDF output file
> -----------------------------------------------------------------------------
>
>                 Key: FOP-3365
>                 URL: https://issues.apache.org/jira/browse/FOP-3365
>             Project: FOP
>          Issue Type: Bug
>          Components: renderer/pdf
>    Affects Versions: 2.12
>            Reporter: Tilman Hausherr
>            Priority: Minor
>         Attachments: fop.pdf, screenshot-1.png
>
>
> Out of curiosity I've been looking at the PDF file generated by {{testMultipleStaticContentArtifact()}} and ran one of the PDFBox tests on it (you need the PDFMergerUtilityTest code in the PDFBox project).
> {code:java}
>         try (PDDocument doc = Loader.loadPDF(file))
>         {
>             PDStructureTreeRoot structureTreeRoot = doc.getDocumentCatalog().getStructureTreeRoot();
>             if (structureTreeRoot != null && structureTreeRoot.getParentTree() != null)
>             {
>                 checkWithNumberTree(doc);
>                 checkForPageOrphans(doc);
>                 Map<String, PDStructureElement> idTreeMap = Collections.emptyMap();
>                 PDNameTreeNode<PDStructureElement> idTree = structureTreeRoot.getIDTree();
>                 if (idTree != null)
>                 {
>                     idTreeMap = idTree.getTreeAsMap();
>                 }
>                 checkForIDTreeOrphans(doc.getPages(), idTreeMap);
>             }
>         }
>         checkStructTreeRootCount(file);
> {code}
> /StructureTreeRoot/ParentTreeNextKey (the next available free key) is missing and should be 2 for the attached file, because keys 0 and 1 are used.
> Example of another file:
>  !screenshot-1.png! 
>  
> {code:java}
> assertEquals(2, pdfDocument.getDocumentCatalog().getStructureTreeRoot().getParentTreeNextKey());
> {code}
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)