Class StructureItems

All Implemented Interfaces:
Serializable, Cloneable, Iterable<StructureItem>, Collection<StructureItem>, List<StructureItem>, RandomAccess, SequencedCollection<StructureItem>

public class StructureItems extends ArrayList<StructureItem>
Creates a list of StructureItem objects extracted from the Structure Tree of a PDF document.
See Also:
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
      The Logger instance
    • structTreeRoot

      protected PdfDictionary structTreeRoot
      The StructTreeRoot dictionary
    • parentTree

      protected HashMap<Integer,PdfObject> parentTree
      The StructParents number tree values.
    • serialVersionUID

      private static final long serialVersionUID
      Serial version UID
      See Also:
  • Constructor Details

  • Method Details

    • processStructElems

      protected void processStructElems(PdfDictionary structElem, PdfIndirectReference ref) throws InvalidPdfException
      Looks at a StructElem dictionary, and processes it.
      Parameters:
      structElem - the StructElem dictionary that needs to be examined
      ref - the reference to the StructElem dictionary
      Throws:
      DocumentException
      InvalidPdfException
    • 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