com.itextpdf.text.pdf.mc
Class StructureItems

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<StructureItem>
              extended by com.itextpdf.text.pdf.mc.StructureItems
All Implemented Interfaces:
Serializable, Cloneable, Iterable<StructureItem>, Collection<StructureItem>, List<StructureItem>, RandomAccess

public class StructureItems
extends ArrayList<StructureItem>

Creates a list of StructureItem objects extracted from the Structure Tree of a PDF document.

See Also:
Serialized Form

Field Summary
protected static Logger LOGGER
          The Logger instance
protected  HashMap<Integer,PdfObject> parentTree
          The StructParents number tree values.
protected  PdfDictionary structTreeRoot
          The StructTreeRoot dictionary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
StructureItems(PdfReader reader)
          Creates a list of StructuredItem objects.
 
Method Summary
 int processMCID(PdfNumber structParents, PdfIndirectReference ref)
          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
protected  void processStructElemKids(PdfDictionary structElem, PdfIndirectReference ref, PdfObject object)
          Processes the kids object of a StructElem dictionary.
protected  void processStructElems(PdfDictionary structElem, PdfIndirectReference ref)
          Looks at a StructElem dictionary, and processes it.
 void removeFromParentTree(PdfNumber structParent)
          Removes a StructParent from the parent tree.
 void writeParentTree(PdfWriter writer)
          Writes the altered parent tree to a PdfWriter and updates the StructTreeRoot entry.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

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.

Constructor Detail

StructureItems

public StructureItems(PdfReader reader)
               throws DocumentException
Creates a list of StructuredItem objects.

Parameters:
reader - the reader holding the PDF to examine
Throws:
DocumentException
Method Detail

processStructElems

protected void processStructElems(PdfDictionary structElem,
                                  PdfIndirectReference ref)
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

processStructElemKids

protected void processStructElemKids(PdfDictionary structElem,
                                     PdfIndirectReference ref,
                                     PdfObject object)
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

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

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


Copyright © 2015. All Rights Reserved.