Class OutlineMerger


  • public final class OutlineMerger
    extends java.lang.Object
    Splices each merge source's own outline (bookmark) tree (/Root/Outlines, ISO 32000-1 12.3.3) onto the end of the merged target's, in the same order PdfMerger processes sources -- mirroring legacy com.pd4ml.pdf.parser.PdfDoc#mergeOutlines's own append-order splice (link the accumulated tree's last top-level node's /Next to the new source's first, re-parent the new source's top-level siblings, sum /Count).

    Scope note, mirroring PdfMerger.mergeOutlines(boolean)'s own javadoc: this assumes every page of a source that contributes an outline is included in the merge (true for both current callers -- PdfDocumentBase#append and PD4ML's own render-time merge seam always select an entire source). An outline node's own /Dest//A destination pointing at a page that was not selected is not pruned the way StructureTreeMerger/UnreachableObjectSweeper together handle for the structure tree -- not needed by either current caller, and left as a documented limitation rather than replicated speculatively.

    • Method Detail

      • mergeSource

        public void mergeSource​(COSDocument sourceDoc,
                                COSDictionary sourceCatalog)
        Call once per source, in the same order PdfMerger itself processes sources.
      • finish

        public COSObject finish()
        Returns:
        the merged /Outlines reference to install on the merged catalog, or null if no source contributed one.