Class OutlineTree


  • public final class OutlineTree
    extends java.lang.Object
    Reads and prunes a document's outline (bookmark) tree (/Root/Outlines, ISO 32000-1 12.3.3) via its /First//Next sibling chain (each node's own children, if any, live under its own /First//Next chain one level down).
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String dump​(COSDictionary catalog)
      Pre-order dump of every node's own /Title, 2-space-indented per level -- matches the legacy PdfDoc#dumpOutlines format exactly (asserted byte-for-byte by existing tests).
      static void pruneForDeletedPage​(COSDictionary catalog, COSObjectKey deletedPageKey)
      Removes every outline node whose own destination resolves to deletedPageKey -- either a plain array-valued /Dest (first element the page reference), a named /Dest (a COSString looked up in the catalog's /Names/Dests name tree -- matching entries are also pruned from that tree, exactly as legacy's PdfDoc#getPageDestinations/cleanDestKids do), or an /A GoTo action's /D in either of those two shapes (not present in legacy's own equivalent, added here since it's the same information reached a different way) -- splicing the node out of its sibling chain.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • dump

        public static java.lang.String dump​(COSDictionary catalog)
        Pre-order dump of every node's own /Title, 2-space-indented per level -- matches the legacy PdfDoc#dumpOutlines format exactly (asserted byte-for-byte by existing tests).
      • pruneForDeletedPage

        public static void pruneForDeletedPage​(COSDictionary catalog,
                                               COSObjectKey deletedPageKey)
        Removes every outline node whose own destination resolves to deletedPageKey -- either a plain array-valued /Dest (first element the page reference), a named /Dest (a COSString looked up in the catalog's /Names/Dests name tree -- matching entries are also pruned from that tree, exactly as legacy's PdfDoc#getPageDestinations/cleanDestKids do), or an /A GoTo action's /D in either of those two shapes (not present in legacy's own equivalent, added here since it's the same information reached a different way) -- splicing the node out of its sibling chain. A removed node's own children are never separately examined (they go with their parent, exactly matching legacy behavior: a node's subtree is only reachable through that node). Every node that is not removed has its own children chain recursively pruned too, so a nested match deeper in an otherwise-kept branch is still found.