Package com.itextpdf.kernel.pdf
Class GenericNameTree
java.lang.Object
com.itextpdf.kernel.pdf.GenericNameTree
- All Implemented Interfaces:
-
IPdfNameTreeAccess
- Direct Known Subclasses:
-
PdfNameTree,PdfStructIdTree
Abstract representation of a name tree structure, as used in PDF for various purposes such as the Dests tree, the ID tree of structure elements and the embedded file tree.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGenericNameTree(PdfDocument pdfDoc) Creates a name tree structure in the current document. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an entry to the name tree.protected voidaddEntry(PdfString key, PdfObject value, Consumer<PdfDocument> onErrorAction) Add an entry to the name tree.voidAdd an entry to the name tree.Build aPdfDictionarycontaining the name tree.Retrieve an entry from the name tree.Retrieve an entry from the name tree.protected final LinkedHashMap<PdfString,PdfObject> getItems()getKeys()Retrieve the set of keys in the name tree.booleanCheck if the tree is modified.protected static LinkedHashMap<PdfString,PdfObject> readTree(PdfDictionary dictionary) Read the entries in a name tree structure from a dictionary object into a linked hash map with fixed order.voidremoveEntry(PdfString key) Remove an entry from the name tree.protected final voidsetItems(LinkedHashMap<PdfString, PdfObject> items) voidSets the modified flag to true.
-
Constructor Details
-
GenericNameTree
Creates a name tree structure in the current document.- Parameters:
-
pdfDoc- the document in which the name tree lives
-
-
Method Details
-
addEntry
Add an entry to the name tree.- Parameters:
-
key- key of the entry -
value- object to add
-
addEntry
Add an entry to the name tree.- Parameters:
-
key- key of the entry -
value- object to add
-
removeEntry
Remove an entry from the name tree.- Parameters:
-
key- key of the entry
-
getEntry
Retrieve an entry from the name tree.- Specified by:
-
getEntryin interfaceIPdfNameTreeAccess - Parameters:
-
key- key of entry to retrieve - Returns:
-
retrieved entry or
nullif absent
-
getEntry
Retrieve an entry from the name tree.- Specified by:
-
getEntryin interfaceIPdfNameTreeAccess - Parameters:
-
key- key of entry to retrieve - Returns:
-
retrieved entry or
nullif absent
-
getKeys
Description copied from interface:IPdfNameTreeAccessRetrieve the set of keys in the name tree.- Specified by:
-
getKeysin interfaceIPdfNameTreeAccess - Returns:
- set of all keys in the name tree
-
isModified
public boolean isModified()Check if the tree is modified.- Returns:
- True if the object has been modified, false otherwise.
-
setModified
public void setModified()Sets the modified flag to true. It means that the object has been modified. -
buildTree
Build aPdfDictionarycontaining the name tree.- Returns:
-
PdfDictionarycontaining the name tree
-
addEntry
Add an entry to the name tree.- Parameters:
-
key- key of the entry -
value- object to add -
onErrorAction- action to perform if such entry exists
-
setItems
-
getItems
-
readTree
Read the entries in a name tree structure from a dictionary object into a linked hash map with fixed order.- Parameters:
-
dictionary- a dictionary object - Returns:
- a map containing the entries in the tree
-