Class UnreachableObjectSweeper


  • public final class UnreachableObjectSweeper
    extends java.lang.Object
    Drops objects from a merge's in-progress target COSDocument that turn out unreachable from its trailer's /Root (and /Info//Encrypt, if present) once all cloning is done.

    COSObjectImporter clones everything transitively reachable from whatever it's asked to import -- including, for a structure element's /Pg back-reference, an entire other page (with all of that page's own resources and annotations) when some selected page's structure subtree happens to reference it, even though that other page was never itself selected for the merge. StructureTreeMerger.finish()'s own pruning already removes such references from the structure tree's /K arrays, but the objects it cloned along the way stay registered in the target document until this sweep runs -- left in place, they'd bloat the output file and leave behind dangling, never-renumbered /StructParents//StructParent integers of their own, which is exactly what a PDF/UA validator flags as an inconsistent entry in the merged structural parent tree.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void sweep​(COSDocument target)  
      • Methods inherited from class java.lang.Object

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

      • sweep

        public static void sweep​(COSDocument target)