|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.pdf.PdfObject
com.lowagie.text.pdf.PdfDictionary
public class PdfDictionary
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 (<<), 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.7'
section 3.2.6 (page 59-60).
PdfObject
,
PdfName
,
BadPdfFormatException
Field Summary | |
---|---|
static PdfName |
CATALOG
This is a possible type of dictionary |
private PdfName |
dictionaryType
This is the type of this dictionary |
static PdfName |
FONT
This is a possible type of dictionary |
protected HashMap |
hashMap
This is the hashmap that contains all the values and keys of the dictionary |
static PdfName |
OUTLINES
This is a possible type of dictionary |
static PdfName |
PAGE
This is a possible type of dictionary |
static PdfName |
PAGES
This is a possible type of dictionary |
Fields inherited from class com.lowagie.text.pdf.PdfObject |
---|
ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, indRef, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type |
Constructor Summary | |
---|---|
PdfDictionary()
Constructs an empty PdfDictionary -object. |
|
PdfDictionary(PdfName type)
Constructs a PdfDictionary -object of a certain type. |
Method Summary | |
---|---|
boolean |
contains(PdfName key)
|
PdfObject |
get(PdfName key)
Gets a PdfObject with a certain key from the PdfDictionary . |
PdfArray |
getAsArray(PdfName key)
|
PdfBoolean |
getAsBoolean(PdfName key)
|
PdfDictionary |
getAsDict(PdfName key)
All the getAs functions will return either null, or the specified object type This function will automatically look up indirect references. |
PdfIndirectReference |
getAsIndirectObject(PdfName key)
|
PdfName |
getAsName(PdfName key)
|
PdfNumber |
getAsNumber(PdfName key)
|
PdfStream |
getAsStream(PdfName key)
|
PdfString |
getAsString(PdfName key)
|
PdfObject |
getDirectObject(PdfName key)
This function behaves the same as 'get', but will never return an indirect reference, it will always look such references up and return the actual object. |
Set |
getKeys()
|
boolean |
isCatalog()
Checks if a Dictionary is of the type CATALOG. |
boolean |
isFont()
Checks if a Dictionary is of the type FONT. |
boolean |
isOutlineTree()
Checks if a Dictionary is of the type OUTLINES. |
boolean |
isPage()
Checks if a Dictionary is of the type PAGE. |
boolean |
isPages()
Checks if a Dictionary is of the type PAGES. |
void |
merge(PdfDictionary other)
|
void |
mergeDifferent(PdfDictionary other)
|
void |
put(PdfName key,
PdfObject value)
Adds a PdfObject and its key to the PdfDictionary . |
void |
putAll(PdfDictionary dic)
|
void |
putEx(PdfName key,
PdfObject value)
Adds a PdfObject and its key to the PdfDictionary . |
void |
remove(PdfName key)
Removes a PdfObject and its key from the PdfDictionary . |
int |
size()
|
void |
toPdf(PdfWriter writer,
OutputStream os)
Returns the PDF representation of this PdfDictionary . |
String |
toString()
Returns the String -representation of this PdfObject . |
Methods inherited from class com.lowagie.text.pdf.PdfObject |
---|
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final PdfName FONT
public static final PdfName OUTLINES
public static final PdfName PAGE
public static final PdfName PAGES
public static final PdfName CATALOG
private PdfName dictionaryType
protected HashMap hashMap
Constructor Detail |
---|
public PdfDictionary()
PdfDictionary
-object.
public PdfDictionary(PdfName type)
PdfDictionary
-object of a certain type.
type
- a PdfName
Method Detail |
---|
public void toPdf(PdfWriter writer, OutputStream os) throws IOException
PdfDictionary
.
toPdf
in class PdfObject
writer
- for backwards compatibilityos
- the outputstream to write the bytes to.
IOException
public void put(PdfName key, PdfObject value)
PdfObject
and its key to the PdfDictionary
.
If the value is null
or PdfNull
the key is deleted.
key
- key of the entry (a PdfName
)value
- value of the entry (a PdfObject
)public void putEx(PdfName key, PdfObject value)
PdfObject
and its key to the PdfDictionary
.
If the value is null it does nothing.
key
- key of the entry (a PdfName
)value
- value of the entry (a PdfObject
)public void remove(PdfName key)
PdfObject
and its key from the PdfDictionary
.
key
- key of the entry (a PdfName
)public PdfObject get(PdfName key)
PdfObject
with a certain key from the PdfDictionary
.
key
- key of the entry (a PdfName
)
public boolean isFont()
Dictionary
is of the type FONT.
true
if it is, false
if it isn't.public boolean isPage()
Dictionary
is of the type PAGE.
true
if it is, false
if it isn't.public boolean isPages()
Dictionary
is of the type PAGES.
true
if it is, false
if it isn't.public boolean isCatalog()
Dictionary
is of the type CATALOG.
true
if it is, false
if it isn't.public boolean isOutlineTree()
Dictionary
is of the type OUTLINES.
true
if it is, false
if it isn't.public void merge(PdfDictionary other)
public void mergeDifferent(PdfDictionary other)
public Set getKeys()
public void putAll(PdfDictionary dic)
public int size()
public boolean contains(PdfName key)
public String toString()
PdfObject
String
-representation of this PdfObject
.
toString
in class PdfObject
String
PdfObject.toString()
public PdfObject getDirectObject(PdfName key)
key
-
public PdfDictionary getAsDict(PdfName key)
key
-
public PdfArray getAsArray(PdfName key)
public PdfStream getAsStream(PdfName key)
public PdfString getAsString(PdfName key)
public PdfNumber getAsNumber(PdfName key)
public PdfName getAsName(PdfName key)
public PdfBoolean getAsBoolean(PdfName key)
public PdfIndirectReference getAsIndirectObject(PdfName key)
|
Hosted by Hostbasket | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |