Class PdfDictionary
- Direct Known Subclasses:
PdfAcroForm, PdfAction, PdfAnnotation, PdfBorderDictionary, PdfDocument.PdfCatalog, PdfDocument.PdfInfo, PdfFileSpecification, PdfGState, PdfLayer, PdfLayerMembership, PdfMediaClipData, PdfOCProperties, PdfOutline, PdfPage, PdfRendition, PdfResources, PdfShadingPattern, PdfSignature, PdfStream, PdfStructureElement, PdfStructureTreeRoot, PdfTransparencyGroup, PdfWriter.PdfTrailer, PRAcroForm
PdfDictionary is the Pdf dictionary object.
A dictionary is an associative table containing pairs of objects. The first element
of each pair is called the key and the second element is called the value.
Unlike dictionaries in the PostScript language, a key must be a PdfName.
A value can be any kind of PdfObject, including a dictionary. A dictionary is
generally used to collect and tie together the attributes of a complex object, with each
key-value pair specifying the name and value of an attribute.
A dictionary is represented by two left angle brackets (invalid input: '<'invalid input: '<'), followed by a sequence of
key-value pairs, followed by two right angle brackets (>>).
This object is described in the 'Portable Document Format Reference Manual version 1.3'
section 4.7 (page 40-41).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PdfNameThis is a possible type of dictionaryprivate PdfNameThis is the type of this dictionarystatic final PdfNameThis is a possible type of dictionaryprotected HashMapThis is the hashmap that contains all the values and keys of the dictionarystatic final PdfNameThis is a possible type of dictionarystatic final PdfNameThis is a possible type of dictionarystatic final PdfNameThis is a possible type of dictionary -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an emptyPdfDictionary-object.PdfDictionary(PdfName type) Constructs aPdfDictionary-object of a certain type. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets aPdfObjectwith a certain key from thePdfDictionary.getAsArray(PdfName key) Returns aPdfObjectas aPdfArray, resolving indirect references.getAsBoolean(PdfName key) Returns aPdfObjectas aPdfBoolean, resolving indirect references.Returns aPdfObjectas aPdfDictionary, resolving indirect references.Returns aPdfObjectas aPdfIndirectReference.Returns aPdfObjectas aPdfName, resolving indirect references.getAsNumber(PdfName key) Returns aPdfObjectas aPdfNumber, resolving indirect references.getAsStream(PdfName key) Returns aPdfObjectas aPdfStream, resolving indirect references.getAsString(PdfName key) Returns aPdfObjectas aPdfString, resolving indirect references.getDirectObject(PdfName key) Returns thePdfObjectassociated to the specified key, resolving a possible indirect reference to a direct object.getKeys()booleanChecks if aDictionaryis of the type CATALOG.booleanisDictionaryType(PdfName type) Deprecated.booleanisFont()Checks if aDictionaryis of the type FONT.booleanChecks if aDictionaryis of the type OUTLINES.booleanisPage()Checks if aDictionaryis of the type PAGE.booleanisPages()Checks if aDictionaryis of the type PAGES.voidmerge(PdfDictionary other) voidmergeDifferent(PdfDictionary other) voidAdds aPdfObjectand its key to thePdfDictionary.voidputAll(PdfDictionary dic) voidAdds aPdfObjectand its key to thePdfDictionary.voidAdds aPdfObjectand its key to thePdfDictionary.voidRemoves aPdfObjectand its key from thePdfDictionary.intsize()voidtoPdf(PdfWriter writer, OutputStream os) Returns the PDF representation of thisPdfDictionary.Methods inherited from class PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, toString, type
-
Field Details
-
FONT
This is a possible type of dictionary -
OUTLINES
This is a possible type of dictionary -
PAGE
This is a possible type of dictionary -
PAGES
This is a possible type of dictionary -
CATALOG
This is a possible type of dictionary -
dictionaryType
This is the type of this dictionary -
hashMap
This is the hashmap that contains all the values and keys of the dictionary
-
-
Constructor Details
-
PdfDictionary
public PdfDictionary()Constructs an emptyPdfDictionary-object. -
PdfDictionary
Constructs aPdfDictionary-object of a certain type.- Parameters:
type- aPdfName
-
-
Method Details
-
toPdf
Returns the PDF representation of thisPdfDictionary.- Overrides:
toPdfin classPdfObject- Parameters:
writer- for backwards compatibilityos- the outputstream to write the bytes to.- Throws:
IOException
-
put
-
putEx
-
putAll
-
putDel
-
remove
Removes aPdfObjectand its key from thePdfDictionary.- Parameters:
key- key of the entry (aPdfName)
-
get
-
getDirectObject
Returns thePdfObjectassociated to the specified key, resolving a possible indirect reference to a direct object. This method will never return aPdfIndirectReferenceobject.- Parameters:
key- A key for thePdfObjectto be returned- Returns:
- A direct
PdfObjectornull
-
getKeys
-
size
public int size() -
contains
-
isDictionaryType
Deprecated.Checks if aPdfDictionaryis of a certain type.- Parameters:
type- a type of dictionary- Returns:
trueoffalse
-
isFont
public boolean isFont()Checks if aDictionaryis of the type FONT.- Returns:
trueif it is,falseif it isn't.
-
isPage
public boolean isPage()Checks if aDictionaryis of the type PAGE.- Returns:
trueif it is,falseif it isn't.
-
isPages
public boolean isPages()Checks if aDictionaryis of the type PAGES.- Returns:
trueif it is,falseif it isn't.
-
isCatalog
public boolean isCatalog()Checks if aDictionaryis of the type CATALOG.- Returns:
trueif it is,falseif it isn't.
-
isOutlineTree
public boolean isOutlineTree()Checks if aDictionaryis of the type OUTLINES.- Returns:
trueif it is,falseif it isn't.
-
merge
-
mergeDifferent
-
getAsDict
Returns aPdfObjectas aPdfDictionary, resolving indirect references. The object associated with thePdfNamegiven is retrieved and resolved to a direct object. If it is aPdfDictionary, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfDictionaryobject, ornull
-
getAsArray
Returns aPdfObjectas aPdfArray, resolving indirect references. The object associated with thePdfNamegiven is retrieved and resolved to a direct object. If it is aPdfArray, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfArrayobject, ornull
-
getAsStream
Returns aPdfObjectas aPdfStream, resolving indirect references. The object associated with thePdfNamegiven is retrieved and resolved to a direct object. If it is aPdfStream, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfStreamobject, ornull
-
getAsString
Returns aPdfObjectas aPdfString, resolving indirect references. The object associated with thePdfNamegiven is retrieved and resolved to a direct object. If it is aPdfString, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfStringobject, ornull
-
getAsNumber
Returns aPdfObjectas aPdfNumber, resolving indirect references. The object associated with thePdfNamegiven is retrieved and resolved to a direct object. If it is aPdfNumber, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfNumberobject, ornull
-
getAsName
Returns aPdfObjectas aPdfName, resolving indirect references. The object associated with thePdfNamegiven is retrieved and resolved to a direct object. If it is aPdfName, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfNameobject, ornull
-
getAsBoolean
Returns aPdfObjectas aPdfBoolean, resolving indirect references. The object associated with thePdfNamegiven is retrieved and resolved to a direct object. If it is aPdfBoolean, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfBooleanobject, ornull
-
getAsIndirectObject
Returns aPdfObjectas aPdfIndirectReference. The object associated with thePdfNamegiven is retrieved If it is aPdfIndirectReference, it is cast down and returned as such. Otherwisenullis returned.- Parameters:
key- APdfName- Returns:
- the associated
PdfIndirectReferenceobject, ornull
-