public class PdfDictionary extends PdfObject
PdfNames and the values are
PdfObjects. Each key can only be associated with one value and
adding a new value to an existing key will override the previous value. A value of null should be ignored when
the PdfDocument is closed.ARRAY, BOOLEAN, DICTIONARY, FLUSHED, FORBID_RELEASE, FREE, INDIRECT_REFERENCE, indirectReference, LITERAL, MODIFIED, MUST_BE_FLUSHED, MUST_BE_INDIRECT, NAME, NULL, NUMBER, ORIGINAL_OBJECT_STREAM, READ_ONLY, READING, STREAM, STRING| Constructor and Description |
|---|
PdfDictionary()
Creates a new PdfDictionary instance.
|
PdfDictionary(Map<PdfName,PdfObject> map)
Creates a new PdfDictionary instance.
|
PdfDictionary(PdfDictionary dictionary)
Creates a new PdfDictionary instance.
|
PdfDictionary(Set<Map.Entry<PdfName,PdfObject>> entrySet)
Creates a new PdfDictionary instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all key-value pairs from this PdfDictionary.
|
PdfDictionary |
clone(List<PdfName> excludeKeys)
Creates clones of the dictionary in the current document.
|
boolean |
containsKey(PdfName key)
Returns true if this PdfDictionary contains the specified key.
|
boolean |
containsValue(PdfObject value)
Returns true if this PdfDictionary contains the specified value.
|
protected void |
copyContent(PdfObject from,
PdfDocument document)
Copies object content from object 'from'.
|
PdfDictionary |
copyTo(PdfDocument document)
Copies object to a specified document.
|
PdfDictionary |
copyTo(PdfDocument document,
boolean allowDuplicating)
Copies object to a specified document.
|
PdfDictionary |
copyTo(PdfDocument document,
List<PdfName> excludeKeys,
boolean allowDuplicating)
Copies dictionary to specified document.
|
Set<Map.Entry<PdfName,PdfObject>> |
entrySet()
Returns a Set holding the key-value pairs as Map#Entry objects.
|
PdfObject |
get(PdfName key)
Returns the value associated to this key.
|
PdfObject |
get(PdfName key,
boolean asDirect) |
PdfArray |
getAsArray(PdfName key)
Returns the value associated to this key as a PdfArray.
|
Boolean |
getAsBool(PdfName key)
Returns the value associated to this key as a Boolean.
|
PdfBoolean |
getAsBoolean(PdfName key)
Returns the value associated to this key as a PdfBoolean.
|
PdfDictionary |
getAsDictionary(PdfName key)
Returns the value associated to this key as a PdfDictionary.
|
Float |
getAsFloat(PdfName key)
Returns the value associated to this key as a Float.
|
Integer |
getAsInt(PdfName key)
Returns the value associated to this key as an Integer.
|
PdfName |
getAsName(PdfName key)
Returns the value associated to this key as a PdfName.
|
PdfNumber |
getAsNumber(PdfName key)
Returns the value associated to this key as a PdfNumber.
|
Rectangle |
getAsRectangle(PdfName key)
Returns the value associated to this key as a Rectangle.
|
PdfStream |
getAsStream(PdfName key)
Returns the value associated to this key as a PdfStream.
|
PdfString |
getAsString(PdfName key)
Returns the value associated to this key as a PdfString.
|
byte |
getType()
Gets object type.
|
boolean |
isEmpty()
Returns true if there are no key-value pairs in this PdfDictionary.
|
Set<PdfName> |
keySet()
Returns all the keys of this PdfDictionary as a Set.
|
PdfDictionary |
makeIndirect(PdfDocument document)
Marks object to be saved as indirect.
|
PdfDictionary |
makeIndirect(PdfDocument document,
PdfIndirectReference reference)
Marks object to be saved as indirect.
|
void |
mergeDifferent(PdfDictionary other)
This method merges different fields from two dictionaries into the current one
|
protected PdfDictionary |
newInstance()
Creates new instance of object.
|
PdfObject |
put(PdfName key,
PdfObject value)
Inserts the value into this PdfDictionary and associates it with the specified key.
|
void |
putAll(PdfDictionary d)
Inserts all the key-value pairs into this PdfDictionary.
|
protected void |
releaseContent()
Release content of PdfDictionary.
|
PdfObject |
remove(PdfName key)
Removes the specified key from this PdfDictionary.
|
int |
size()
Returns the number of key-value pairs in this PdfDictionary.
|
String |
toString() |
Collection<PdfObject> |
values()
Returns all the values of this map in a Collection.
|
checkState, clearState, clone, flush, flush, getIndirectReference, isArray, isBoolean, isDictionary, isFlushed, isIndirect, isIndirectReference, isLiteral, isModified, isName, isNull, isNumber, isStream, isString, release, setIndirectReference, setModified, setStatepublic PdfDictionary()
public PdfDictionary(Map<PdfName,PdfObject> map)
map - Map containing values to be inserted into PdfDictionarypublic PdfDictionary(Set<Map.Entry<PdfName,PdfObject>> entrySet)
entrySet - Set containing Map#Entries to be inserted into PdfDictionarypublic PdfDictionary(PdfDictionary dictionary)
dictionary - PdfDictionary containing values to be inserted into PdfDictionarypublic int size()
public boolean isEmpty()
public boolean containsKey(PdfName key)
key - the key to checkpublic boolean containsValue(PdfObject value)
value - the value to checkpublic PdfObject get(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfArray getAsArray(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfDictionary getAsDictionary(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfStream getAsStream(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfNumber getAsNumber(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfName getAsName(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfString getAsString(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfBoolean getAsBoolean(PdfName key)
key - the key of which the associated value needs to be returnedpublic Rectangle getAsRectangle(PdfName key)
key - the key of which the associated value needs to be returnedPdfArray.toRectangle()public Float getAsFloat(PdfName key)
key - the key of which the associated value needs to be returnedpublic Integer getAsInt(PdfName key)
key - the key of which the associated value needs to be returnedpublic Boolean getAsBool(PdfName key)
key - the key of which the associated value needs to be returnedpublic PdfObject put(PdfName key, PdfObject value)
key - key to insert or to overridevalue - the value to associate with the specified keypublic PdfObject remove(PdfName key)
key - key to be removedpublic void putAll(PdfDictionary d)
d - PdfDictionary holding the key-value pairs to be copiedpublic void clear()
public Set<PdfName> keySet()
public Collection<PdfObject> values()
public Set<Map.Entry<PdfName,PdfObject>> entrySet()
public byte getType()
PdfObjectpublic PdfDictionary clone(List<PdfName> excludeKeys)
excludeKeys - list of objects to exclude when cloning dictionary.PdfExceptionpublic PdfDictionary makeIndirect(PdfDocument document)
makeIndirect in class PdfObjectdocument - a document the indirect reference will belong to.public PdfDictionary makeIndirect(PdfDocument document, PdfIndirectReference reference)
makeIndirect in class PdfObjectdocument - a document the indirect reference will belong to.public PdfDictionary copyTo(PdfDocument document)
public PdfDictionary copyTo(PdfDocument document, boolean allowDuplicating)
copyTo in class PdfObjectdocument - document to copy object to.allowDuplicating - indicates if to allow copy objects which already have been copied.
If object is associated with any indirect reference and allowDuplicating is false then already existing reference will be returned instead of copying object.
If allowDuplicating is true then object will be copied and new indirect reference will be assigned.public PdfDictionary copyTo(PdfDocument document, List<PdfName> excludeKeys, boolean allowDuplicating)
document - document to copy dictionary to.excludeKeys - list of objects to exclude when copying dictionary.allowDuplicating - PdfObject.copyTo(PdfDocument, boolean)PdfExceptionpublic PdfObject get(PdfName key, boolean asDirect)
asDirect - true is to extract direct object always.PdfExceptionpublic void mergeDifferent(PdfDictionary other)
other - a dictionary whose fields should be merged into the current dictionary.protected PdfDictionary newInstance()
PdfObjectnewInstance in class PdfObjectprotected void copyContent(PdfObject from, PdfDocument document)
PdfObjectcopyContent in class PdfObjectfrom - object to copy content from.document - document to copy object to.protected void releaseContent()
Copyright © 1998–2016 iText Group NV. All rights reserved.