Package com.itextpdf.text.pdf.mc
Class StructureItems
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<StructureItem>
,Collection<StructureItem>
,List<StructureItem>
,RandomAccess
Creates a list of StructureItem objects extracted from the
Structure Tree of a PDF document.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Logger
The Logger instanceThe StructParents number tree values.private static final long
Serial version UIDprotected PdfDictionary
The StructTreeRoot dictionaryFields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
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.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 streamprotected 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, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Field Details
-
LOGGER
The Logger instance -
structTreeRoot
The StructTreeRoot dictionary -
parentTree
The StructParents number tree values. -
serialVersionUID
private static final long serialVersionUIDSerial version UID- See Also:
-
-
Constructor Details
-
StructureItems
Creates a list of StructuredItem objects.- Parameters:
reader
- the reader holding the PDF to examine- Throws:
DocumentException
InvalidPdfException
-
-
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 examinedref
- 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 dictionaryref
- the reference to the StructElem dictionaryobject
- the kids object- Throws:
InvalidPdfException
-
removeFromParentTree
Removes a StructParent from the parent tree.- Parameters:
structParent
- the number to remove
-
processMCID
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 dictionaryref
- the item for which we need a new MCID- Returns:
- a new MCID
- Throws:
DocumentException
-
getNextMCID
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
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
-