Class StructureItems
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<StructureItem>, Collection<StructureItem>, List<StructureItem>, RandomAccess, SequencedCollection<StructureItem>
Creates a list of StructureItem objects extracted from the
Structure Tree of a PDF document.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final LoggerThe Logger instanceThe StructParents number tree values.private static final longSerial version UIDprotected PdfDictionaryThe StructTreeRoot dictionaryFields inherited from class AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetNextMCID(PdfNumber structParents) Finds the next available MCID, which is either the lowest empty ID in the existing range, or the first available higher number.intprocessMCID(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 voidprocessStructElemKids(PdfDictionary structElem, PdfIndirectReference ref, PdfObject object) Processes the kids object of a StructElem dictionary.protected voidprocessStructElems(PdfDictionary structElem, PdfIndirectReference ref) Looks at a StructElem dictionary, and processes it.voidremoveFromParentTree(PdfNumber structParent) Removes a StructParent from the parent tree.voidwriteParentTree(PdfWriter writer) Writes the altered parent tree to a PdfWriter and updates the StructTreeRoot entry.Methods inherited from class ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Field Details
-
LOGGER
The Logger instance -
structTreeRoot
The StructTreeRoot dictionary -
parentTree
-
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:
DocumentExceptionInvalidPdfException
-
-
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:
DocumentExceptionInvalidPdfException
-
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
-