iText 7 7.1.9 API
iText.Kernel.Pdf.PdfDictionary Class Reference

A representation of a Dictionary as described by the PDF Specification. More...

Inheritance diagram for iText.Kernel.Pdf.PdfDictionary:
iText.Kernel.Pdf.PdfObject iText.Kernel.Pdf.PdfStream

Public Member Functions

  PdfDictionary ()
  Creates a new PdfDictionary instance. More...
 
  PdfDictionary (IDictionary< PdfName, PdfObject > map)
  Creates a new PdfDictionary instance. More...
 
  PdfDictionary (ICollection< KeyValuePair< PdfName, PdfObject >> entrySet)
  Creates a new PdfDictionary instance. More...
 
  PdfDictionary (iText.Kernel.Pdf.PdfDictionary dictionary)
  Creates a new PdfDictionary instance. More...
 
virtual int  Size ()
  Returns the number of key-value pairs in this PdfDictionary. More...
 
virtual bool  IsEmpty ()
  Returns true if there are no key-value pairs in this PdfDictionary. More...
 
virtual bool  ContainsKey (PdfName key)
  Returns true if this PdfDictionary contains the specified key. More...
 
virtual bool  ContainsValue (PdfObject value)
  Returns true if this PdfDictionary contains the specified value. More...
 
virtual PdfObject  Get (PdfName key)
  Returns the value associated to this key. More...
 
virtual PdfArray  GetAsArray (PdfName key)
  Returns the value associated to this key as a PdfArray. More...
 
virtual iText.Kernel.Pdf.PdfDictionary  GetAsDictionary (PdfName key)
  Returns the value associated to this key as a PdfDictionary. More...
 
virtual PdfStream  GetAsStream (PdfName key)
  Returns the value associated to this key as a PdfStream. More...
 
virtual PdfNumber  GetAsNumber (PdfName key)
  Returns the value associated to this key as a PdfNumber. More...
 
virtual PdfName  GetAsName (PdfName key)
  Returns the value associated to this key as a PdfName. More...
 
virtual PdfString  GetAsString (PdfName key)
  Returns the value associated to this key as a PdfString. More...
 
virtual PdfBoolean  GetAsBoolean (PdfName key)
  Returns the value associated to this key as a PdfBoolean. More...
 
virtual Rectangle  GetAsRectangle (PdfName key)
  Returns the value associated to this key as a Rectangle. More...
 
virtual ? float  GetAsFloat (PdfName key)
  Returns the value associated to this key as a Float. More...
 
virtual ? int  GetAsInt (PdfName key)
  Returns the value associated to this key as an Integer. More...
 
virtual ? bool  GetAsBool (PdfName key)
  Returns the value associated to this key as a Boolean. More...
 
virtual PdfObject  Put (PdfName key, PdfObject value)
  Inserts the value into this PdfDictionary and associates it with the specified key. More...
 
virtual PdfObject  Remove (PdfName key)
  Removes the specified key from this PdfDictionary. More...
 
virtual void  PutAll (iText.Kernel.Pdf.PdfDictionary d)
  Inserts all the key-value pairs into this PdfDictionary. More...
 
virtual void  Clear ()
  Removes all key-value pairs from this PdfDictionary. More...
 
virtual ICollection< PdfName KeySet ()
  Returns all the keys of this PdfDictionary as a Set. More...
 
virtual ICollection< PdfObject Values (bool asDirects)
  Returns all the values of this map in a Collection. More...
 
virtual ICollection< PdfObject Values ()
  Returns all the values of this map in a Collection. More...
 
virtual ICollection< KeyValuePair< PdfName, PdfObject > >  EntrySet ()
  Returns a Set holding the key-value pairs as Map::Entry objects. More...
 
override byte  GetObjectType ()
  Gets object type. More...
 
override String  ToString ()
 
virtual iText.Kernel.Pdf.PdfDictionary  Clone (IList< PdfName > excludeKeys)
  Creates clones of the dictionary in the current document. More...
 
virtual iText.Kernel.Pdf.PdfDictionary  CopyTo (PdfDocument document, IList< PdfName > excludeKeys, bool allowDuplicating)
  Copies dictionary to specified document. More...
 
virtual PdfObject  Get (PdfName key, bool asDirect)
 
Parameters
asDirect true is to extract direct object always.

 
virtual void  MergeDifferent (iText.Kernel.Pdf.PdfDictionary other)
  This method merges different fields from two dictionaries into the current one More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfObject
void  Flush ()
  Flushes the object to the document. More...
 
void  Flush (bool canBeInObjStm)
  Flushes the object to the document. More...
 
virtual PdfIndirectReference  GetIndirectReference ()
  Gets the indirect reference associated with the object. More...
 
virtual bool  IsIndirect ()
  Checks if object is indirect. More...
 
virtual PdfObject  MakeIndirect (PdfDocument document, PdfIndirectReference reference)
  Marks object to be saved as indirect. More...
 
virtual PdfObject  MakeIndirect (PdfDocument document)
  Marks object to be saved as indirect. More...
 
virtual bool  IsFlushed ()
  Indicates is the object has been flushed or not. More...
 
virtual bool  IsModified ()
  Indicates is the object has been set as modified or not. More...
 
virtual PdfObject  Clone ()
  Creates clone of the object which belongs to the same document as original object. More...
 
virtual PdfObject  CopyTo (PdfDocument document)
  Copies object to a specified document. More...
 
virtual PdfObject  CopyTo (PdfDocument document, bool allowDuplicating)
  Copies object to a specified document. More...
 
virtual PdfObject  SetModified ()
  Sets the 'modified' flag to the indirect object, the flag denotes that the object was modified since the document opening. More...
 
virtual bool  IsReleaseForbidden ()
  Checks if it's forbidden to release this PdfObject instance. More...
 
virtual void  Release ()
 
virtual bool  IsNull ()
  Checks if this PdfObject is of the type PdfNull. More...
 
virtual bool  IsBoolean ()
  Checks if this PdfObject is of the type PdfBoolean. More...
 
virtual bool  IsNumber ()
  Checks if this PdfObject is of the type PdfNumber. More...
 
virtual bool  IsString ()
  Checks if this PdfObject is of the type PdfString. More...
 
virtual bool  IsName ()
  Checks if this PdfObject is of the type PdfName. More...
 
virtual bool  IsArray ()
  Checks if this PdfObject is of the type PdfArray. More...
 
virtual bool  IsDictionary ()
  Checks if this PdfObject is of the type PdfDictionary. More...
 
virtual bool  IsStream ()
  Checks if this PdfObject is of the type PdfStream. More...
 
virtual bool  IsIndirectReference ()
  Checks if this PdfObject is of the type PdfIndirectReference. More...
 
virtual bool  IsLiteral ()
  Checks if this PdfObject is of the type PdfLiteral. More...
 

Additional Inherited Members

- Static Public Attributes inherited from iText.Kernel.Pdf.PdfObject
const byte  ARRAY = 1
 
const byte  BOOLEAN = 2
 
const byte  DICTIONARY = 3
 
const byte  LITERAL = 4
 
const byte  INDIRECT_REFERENCE = 5
 
const byte  NAME = 6
 
const byte  NULL = 7
 
const byte  NUMBER = 8
 
const byte  STREAM = 9
 
const byte  STRING = 10
 

Detailed Description

A representation of a Dictionary as described by the PDF Specification.

A representation of a Dictionary as described by the PDF Specification. A Dictionary is a mapping between keys and values. Keys are 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.

Constructor & Destructor Documentation

◆ PdfDictionary() [1/4]

iText.Kernel.Pdf.PdfDictionary.PdfDictionary ( )
inline

Creates a new PdfDictionary instance.

◆ PdfDictionary() [2/4]

iText.Kernel.Pdf.PdfDictionary.PdfDictionary ( IDictionary< PdfName, PdfObject map )
inline

Creates a new PdfDictionary instance.

Creates a new PdfDictionary instance. This constructor inserts the content of the specified Map into this PdfDictionary instance.

Parameters
map Map containing values to be inserted into PdfDictionary

◆ PdfDictionary() [3/4]

iText.Kernel.Pdf.PdfDictionary.PdfDictionary ( ICollection< KeyValuePair< PdfName, PdfObject >>  entrySet )
inline

Creates a new PdfDictionary instance.

Creates a new PdfDictionary instance. This constructor inserts the content of the specified Set into this PdfDictionary instance.

Parameters
entrySet Set containing Map::Entries to be inserted into PdfDictionary

◆ PdfDictionary() [4/4]

iText.Kernel.Pdf.PdfDictionary.PdfDictionary ( iText.Kernel.Pdf.PdfDictionary  dictionary )
inline

Creates a new PdfDictionary instance.

Creates a new PdfDictionary instance. This constructor inserts the content of the specified PdfDictionary into this PdfDictionary instance.

Parameters
dictionary PdfDictionary containing values to be inserted into PdfDictionary

Member Function Documentation

◆ Clear()

virtual void iText.Kernel.Pdf.PdfDictionary.Clear ( )
inlinevirtual

Removes all key-value pairs from this PdfDictionary.

◆ Clone()

virtual iText.Kernel.Pdf.PdfDictionary iText.Kernel.Pdf.PdfDictionary.Clone ( IList< PdfName excludeKeys )
inlinevirtual

Creates clones of the dictionary in the current document.

Creates clones of the dictionary in the current document. It's possible to pass a list of keys to exclude when cloning.

Parameters
excludeKeys list of objects to exclude when cloning dictionary.
Returns
cloned dictionary.

◆ ContainsKey()

virtual bool iText.Kernel.Pdf.PdfDictionary.ContainsKey ( PdfName  key )
inlinevirtual

Returns true if this PdfDictionary contains the specified key.

Parameters
key the key to check
Returns
true if key is present in the PdfDictionary

◆ ContainsValue()

virtual bool iText.Kernel.Pdf.PdfDictionary.ContainsValue ( PdfObject  value )
inlinevirtual

Returns true if this PdfDictionary contains the specified value.

Parameters
value the value to check
Returns
true if value is present in the PdfDictionary

◆ CopyTo()

virtual iText.Kernel.Pdf.PdfDictionary iText.Kernel.Pdf.PdfDictionary.CopyTo ( PdfDocument  document,
IList< PdfName excludeKeys,
bool  allowDuplicating 
)
inlinevirtual

Copies dictionary to specified document.

Copies dictionary to specified document. It's possible to pass a list of keys to exclude when copying.

Parameters
document document to copy dictionary to.
excludeKeys list of objects to exclude when copying dictionary.
allowDuplicating

PdfObject.CopyTo(PdfDocument, bool)

Returns
copied dictionary.

◆ EntrySet()

virtual ICollection<KeyValuePair<PdfName, PdfObject> > iText.Kernel.Pdf.PdfDictionary.EntrySet ( )
inlinevirtual

Returns a Set holding the key-value pairs as Map::Entry objects.

Returns a Set holding the key-value pairs as Map::Entry objects.
NOTE: since 7.0.1 it returns collection of direct objects. If you want to get PdfIndirectReference instances for the indirect objects value, you shall use Get(PdfName, bool) method.

Returns
a Set of Map.Entry objects

◆ Get()

virtual PdfObject iText.Kernel.Pdf.PdfDictionary.Get ( PdfName  key )
inlinevirtual

Returns the value associated to this key.

Parameters
key the key of which the associated value needs to be returned
Returns
the value associated with this key

◆ GetAsArray()

virtual PdfArray iText.Kernel.Pdf.PdfDictionary.GetAsArray ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a PdfArray.

Returns the value associated to this key as a PdfArray. If the value isn't a PdfArray, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfArray associated with this key

◆ GetAsBool()

virtual ? bool iText.Kernel.Pdf.PdfDictionary.GetAsBool ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a Boolean.

Returns the value associated to this key as a Boolean. If the value isn't a PdfBoolean, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
Boolean associated with this key

◆ GetAsBoolean()

virtual PdfBoolean iText.Kernel.Pdf.PdfDictionary.GetAsBoolean ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a PdfBoolean.

Returns the value associated to this key as a PdfBoolean. If the value isn't a PdfBoolean, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfBoolean associated with this key

◆ GetAsDictionary()

virtual iText.Kernel.Pdf.PdfDictionary iText.Kernel.Pdf.PdfDictionary.GetAsDictionary ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a PdfDictionary.

Returns the value associated to this key as a PdfDictionary. If the value isn't a PdfDictionary, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfDictionary associated with this key

◆ GetAsFloat()

virtual ? float iText.Kernel.Pdf.PdfDictionary.GetAsFloat ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a Float.

Returns the value associated to this key as a Float. If the value isn't a Pdfnumber, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
Float associated with this key

◆ GetAsInt()

virtual ? int iText.Kernel.Pdf.PdfDictionary.GetAsInt ( PdfName  key )
inlinevirtual

Returns the value associated to this key as an Integer.

Returns the value associated to this key as an Integer. If the value isn't a Pdfnumber, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
Integer associated with this key

◆ GetAsName()

virtual PdfName iText.Kernel.Pdf.PdfDictionary.GetAsName ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a PdfName.

Returns the value associated to this key as a PdfName. If the value isn't a PdfName, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfName associated with this key

◆ GetAsNumber()

virtual PdfNumber iText.Kernel.Pdf.PdfDictionary.GetAsNumber ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a PdfNumber.

Returns the value associated to this key as a PdfNumber. If the value isn't a PdfNumber, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfNumber associated with this key

◆ GetAsRectangle()

virtual Rectangle iText.Kernel.Pdf.PdfDictionary.GetAsRectangle ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a Rectangle.

Returns the value associated to this key as a Rectangle. If the value isn't a PdfArray of which the firt four elements are PdfNumbers, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfArray associated with this key
See also
PdfArray.ToRectangle()

◆ GetAsStream()

virtual PdfStream iText.Kernel.Pdf.PdfDictionary.GetAsStream ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a PdfStream.

Returns the value associated to this key as a PdfStream. If the value isn't a PdfStream, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfStream associated with this key

◆ GetAsString()

virtual PdfString iText.Kernel.Pdf.PdfDictionary.GetAsString ( PdfName  key )
inlinevirtual

Returns the value associated to this key as a PdfString.

Returns the value associated to this key as a PdfString. If the value isn't a PdfString, null is returned.

Parameters
key the key of which the associated value needs to be returned
Returns
PdfString associated with this key

◆ GetObjectType()

override byte iText.Kernel.Pdf.PdfDictionary.GetObjectType ( )
inlinevirtual

Gets object type.

Returns
object type.

Implements iText.Kernel.Pdf.PdfObject.

Reimplemented in iText.Kernel.Pdf.PdfStream.

◆ IsEmpty()

virtual bool iText.Kernel.Pdf.PdfDictionary.IsEmpty ( )
inlinevirtual

Returns true if there are no key-value pairs in this PdfDictionary.

Returns
true if there are no key-value pairs in this PdfDictionary

◆ KeySet()

virtual ICollection<PdfName> iText.Kernel.Pdf.PdfDictionary.KeySet ( )
inlinevirtual

Returns all the keys of this PdfDictionary as a Set.

Returns
Set of keys

◆ MergeDifferent()

virtual void iText.Kernel.Pdf.PdfDictionary.MergeDifferent ( iText.Kernel.Pdf.PdfDictionary  other )
inlinevirtual

This method merges different fields from two dictionaries into the current one

Parameters
other a dictionary whose fields should be merged into the current dictionary.

◆ Put()

virtual PdfObject iText.Kernel.Pdf.PdfDictionary.Put ( PdfName  key,
PdfObject  value 
)
inlinevirtual

Inserts the value into this PdfDictionary and associates it with the specified key.

Inserts the value into this PdfDictionary and associates it with the specified key. If the key is already present in this PdfDictionary, this method will override the old value with the specified one.

Parameters
key key to insert or to override
value the value to associate with the specified key
Returns
the previous PdfObject associated with this key

◆ PutAll()

virtual void iText.Kernel.Pdf.PdfDictionary.PutAll ( iText.Kernel.Pdf.PdfDictionary  d )
inlinevirtual

Inserts all the key-value pairs into this PdfDictionary.

Parameters
d PdfDictionary holding the key-value pairs to be copied

◆ Remove()

virtual PdfObject iText.Kernel.Pdf.PdfDictionary.Remove ( PdfName  key )
inlinevirtual

Removes the specified key from this PdfDictionary.

Parameters
key key to be removed
Returns
the removed value associated with the specified key

◆ Size()

virtual int iText.Kernel.Pdf.PdfDictionary.Size ( )
inlinevirtual

Returns the number of key-value pairs in this PdfDictionary.

Returns
number of key-value pairs

◆ Values() [1/2]

virtual ICollection<PdfObject> iText.Kernel.Pdf.PdfDictionary.Values ( )
inlinevirtual

Returns all the values of this map in a Collection.

Returns all the values of this map in a Collection.
NOTE: since 7.0.1 it returns collection of direct objects. If you want to get PdfIndirectReference instances for the indirect objects value, you shall use Values(bool) method.

Returns
a Collection holding all the values

◆ Values() [2/2]

virtual ICollection<PdfObject> iText.Kernel.Pdf.PdfDictionary.Values ( bool  asDirects )
inlinevirtual

Returns all the values of this map in a Collection.

Parameters
asDirects if false, collection will contain PdfIndirectReference instances for the indirect objects in dictionary, otherwise it will contain collection of direct objects.
Returns
a Collection holding all the values