Class StructureItems

    • Field Detail

      • LOGGER

        protected static final Logger LOGGER
        The Logger instance
      • structTreeRoot

        protected PdfDictionary structTreeRoot
        The StructTreeRoot dictionary
    • Method Detail

      • processStructElemKids

        protected void processStructElemKids​(PdfDictionary structElem,
                                             PdfIndirectReference ref,
                                             PdfObject object)
                                      throws InvalidPdfException
        Processes the kids object of a StructElem dictionary. This kids object can be a number (MCID), another StructElem dictionary, an MCR dictionary, an OBJR dictionary, or an array of the above.
        Parameters:
        structElem - the StructElem dictionary
        ref - the reference to the StructElem dictionary
        object - the kids object
        Throws:
        InvalidPdfException
      • removeFromParentTree

        public void removeFromParentTree​(PdfNumber structParent)
        Removes a StructParent from the parent tree.
        Parameters:
        structParent - the number to remove
      • processMCID

        public int processMCID​(PdfNumber structParents,
                               PdfIndirectReference ref)
                        throws DocumentException
        Creates a new MCID in the parent tree of the page and returns that new MCID so that it can be used in the content stream
        Parameters:
        structParents - the StructParents entry in the page dictionary
        ref - the item for which we need a new MCID
        Returns:
        a new MCID
        Throws:
        DocumentException
      • getNextMCID

        public int getNextMCID​(PdfNumber structParents)
        Finds the next available MCID, which is either the lowest empty ID in the existing range, or the first available higher number.
        Parameters:
        structParents - the StructParents entry in the page dictionary
        Returns:
        the first available MCID
      • writeParentTree

        public void writeParentTree​(PdfWriter writer)
                             throws IOException
        Writes the altered parent tree to a PdfWriter and updates the StructTreeRoot entry.
        Parameters:
        writer - The writer to which the StructParents have to be written
        Throws:
        IOException