Class ParentTreeHandler


  • class ParentTreeHandler
    extends java.lang.Object
    Internal helper class which is used to effectively build parent tree and also find marked content references: for specified page, by MCID or by struct parent index.
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • parentTree

        private PdfNumTree parentTree
        Represents parentTree in structTreeRoot. It contains only those entries that belong to the already flushed pages.
      • pageToStructParentsInd

        private java.util.Map<PdfIndirectReference,​java.lang.Integer> pageToStructParentsInd
      • xObjectToStructParentsInd

        private java.util.Map<PdfIndirectReference,​java.lang.Integer> xObjectToStructParentsInd
      • maxStructParentIndex

        private int maxStructParentIndex
    • Constructor Detail

      • ParentTreeHandler

        ParentTreeHandler​(PdfStructTreeRoot structTreeRoot)
        Init ParentTreeHandler. On init the parent tree is read and stored in this instance.
    • Method Detail

      • findObjRefByStructParentIndex

        public PdfObjRef findObjRefByStructParentIndex​(PdfDictionary pageDict,
                                                       int structParentIndex)
      • getNextMcidForPage

        public int getNextMcidForPage​(PdfPage page)
      • createParentTreeEntryForPage

        public void createParentTreeEntryForPage​(PdfPage page)
        Creates and flushes parent tree entry for the page. Effectively this means that new content mustn't be added to the page.
        Parameters:
        page - PdfPage for which to create parent tree entry. Typically this page is flushed after this call.
      • savePageStructParentIndexIfNeeded

        public void savePageStructParentIndexIfNeeded​(PdfPage page)
      • registerMcr

        public void registerMcr​(PdfMcr mcr)
      • registerMcr

        private void registerMcr​(PdfMcr mcr,
                                 boolean registeringOnInit)
      • unregisterMcr

        public void unregisterMcr​(PdfMcr mcrToUnregister)
      • isModificationAllowed

        private boolean isModificationAllowed()
      • registerAllMcrs

        private void registerAllMcrs()
      • updateStructParentTreeForContentStreamEntries

        private boolean updateStructParentTreeForContentStreamEntries​(java.util.Map<java.lang.Integer,​PdfMcr> mcrsOfContentStream,
                                                                      int pageStructParentIndex)
      • getOrCreatePageStructParentIndex

        private int getOrCreatePageStructParentIndex​(PdfPage page)