Package com.pd4ml.pdf.cos.util
Class OutlineTree
- java.lang.Object
-
- com.pd4ml.pdf.cos.util.OutlineTree
-
public final class OutlineTree extends java.lang.ObjectReads and prunes a document's outline (bookmark) tree (/Root/Outlines, ISO 32000-1 12.3.3) via its/First//Nextsibling chain (each node's own children, if any, live under its own/First//Nextchain one level down).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringdump(COSDictionary catalog)Pre-order dump of every node's own/Title, 2-space-indented per level -- matches the legacyPdfDoc#dumpOutlinesformat exactly (asserted byte-for-byte by existing tests).static voidpruneForDeletedPage(COSDictionary catalog, COSObjectKey deletedPageKey)Removes every outline node whose own destination resolves todeletedPageKey-- either a plain array-valued/Dest(first element the page reference), a named/Dest(aCOSStringlooked up in the catalog's/Names/Destsname tree -- matching entries are also pruned from that tree, exactly as legacy'sPdfDoc#getPageDestinations/cleanDestKidsdo), or an/AGoTo action's/Din 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.
-
-
-
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 legacyPdfDoc#dumpOutlinesformat 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 todeletedPageKey-- either a plain array-valued/Dest(first element the page reference), a named/Dest(aCOSStringlooked up in the catalog's/Names/Destsname tree -- matching entries are also pruned from that tree, exactly as legacy'sPdfDoc#getPageDestinations/cleanDestKidsdo), or an/AGoTo action's/Din 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.
-
-