PDFDict Class Documentation

class PDFDict : PDFObject

Namespace:Datalogics::PDFL

Inherits from:
PDFObject

Detailed Description

Represents an associative collection of data elements within a PDF document.

All objects in a PDF document are built from a collection of simpler objects that represent fundamental datatypes like numbers, strings and arrays. PDFObject and its subclasses allow direct access and manipulation of these simple objects. Some subclasses represent single data elements, such as PDFInteger, which represents a single integer value. Other subclasses represent a collection of PDFObjects, like PDFArray, an indexed array of data elements.

A PDFDict is a heterogenous collection object that maps other PDFObjects (including other PDFDicts) to PDFName objects.

Constructor & Destructor Documentation

PDFDict

PDFDict(Document doc, bool indirect)

Parameters

doc: Document

Document object containing this PDFDict

indirect: bool

flag marking this as an indirect PDFObject

General constructor

PDFDict

PDFDict(PDFObject docFromObj, bool indirect)

Parameters

docFromObj: PDFObject

The new PDFArray will be created in the same document as this object.

indirect: bool

flag marking this as an indirect PDFObject

General constructor

Property Documentation

Document

Document Document[get]

The Document of which this object is a member.

Returns null if the Document is not known by PDFL, or if it is a temporary document.

If the Document is not null, then it shares the same internal data with other Document objects that refer to the same file. Document objects returned this way do not contribute to the internal count that keeps the Document open, and will become invalid if the main reference to the document is disposed.

Generation

int Generation[get]

The generation number for this object.

Only indirect objects have a generation number.

Exceptions

ApplicationException
—

direct objects do not have a generation number.

ID

int ID[get]

The ID number for this object.

Only indirect objects have an ID number.

Exceptions

ApplicationException
—

direct objects do not have an ID number.

Indirect

bool Indirect[get]

Indicates if this object is indirect or direct.

Keys

System.Collections.Generic.IList< PDFObject > Keys[get]

Get a list of all keys in the dictionary

PDFHashValue

int PDFHashValue[get]

The 32-bit hash value for this object.

The hash value is used internally to quickly access the object, and is not generally useful for PDFObject users. Note that two PDFObjects with equal hash values are not necessarily equal; use Equals() to check for equality.

XMPMetadata

string XMPMetadata[get, set]

The XMP metadata associated with this dictionary.

NULL if there is no such data.

Note: PDFL will not attempt to verify that obj is one of the objects specified to allow XMP metadata by the PDF reference.

Member Function Documentation

Clone

PDFObject Clone()

Returns:

PDFObject

A new PDFObject that is a copy of this object.

Makes a new copy of this PDFObject in memory, in the same document and using same direct/indirect setting as this PDFObject.

Clone

PDFObject Clone(Document doc)

Parameters

doc: Document

The target document in which to create the copy.

Returns:

PDFObject

A new PDFObject that is a copy of this object in the specified document.

Makes a new copy of this PDFObject in memory, in the supplied document, using the same direct/indirect setting as this PDFObject.

Clone

PDFObject Clone(Document doc, bool indirect)

Parameters

doc: Document

The target document in which to create the copy.

indirect: bool

If true, the copy will be an indirect object; if false, it will be direct.

Returns:

PDFObject

A new PDFObject that is a copy of this object in the specified document.

Makes a new copy of this PDFObject in memory, in the supplied document, using supplied direct/indirect setting.

Clone

PDFObject Clone(PDFObject obj)

Parameters

obj: PDFObject

The reference object whose document will be used for the copy.

Returns:

PDFObject

A new PDFObject that is a copy of this object in the same document as obj.

Makes a new copy of this PDFObject in memory, in the same document as another object, using the same direct/indirect setting as this PDFObject.

Clone

PDFObject Clone(PDFObject obj, bool indirect)

Parameters

obj: PDFObject

The reference object whose document will be used for the copy.

indirect: bool

If true, the copy will be an indirect object; if false, it will be direct.

Returns:

PDFObject

A new PDFObject that is a copy of this object in the same document as obj.

Makes a new copy of this PDFObject in memory, in the same document as another object, using supplied direct/indirect setting.

CompareTo

Parameters

rhs: PDFObject

the other PDFObject to compare.

Returns:

PDFObjectComparison

A PDFObjectComparison value that relates this object to the rhs object

Compares this object to another object. The result is useful for ordering or sorting PDFObjects. No other significance should be attached to the result. In particular, an unequal result indicates nothing about the type of either object.

The result is valid only within a single instance of the document.

Contains

bool Contains(PDFName key)

Parameters

key: PDFName

A PDFName for the key

Returns:

bool

true if the given key exists

Tests whether the given key exists in the dictionary

Contains

bool Contains(string key)

Parameters

key: string

A string representing the name for the key

Returns:

bool

true if the given key exists

Tests whether the given key exists in the dictionary

Destroy

void Destroy()

Returns:

void

Destroys this object.

This method does nothing if this object is a direct scalar object.

If a composite object (an array, dictionary or stream) is destroyed:

• All the direct objects in it are automatically destroyed.

• The indirect objects in it are not destroyed.

Dispose

void Dispose()

Returns:

void

EnumPDFObjects

bool EnumPDFObjects(PDFObjectEnumProc enumProc)

Parameters

enumProc: PDFObjectEnumProc

A user-supplied callback to call for each element of the object. of obj. Neither proc nor any routine called by proc may modify the object. Doing so can produce undefined results or errors. For example, if the object is an array, enumProc must not call Remove(); if the object is a dictionary, enumProc must not call Put().

Returns:

bool

Returns true if every call to enumProc returned true. As soon as any call to enumProc returns false, the enumeration stops and EnumPDFObject() returns false.

Enumerates the elements of a PDFObject by calling a user-supplied procedure for each component of the object.

• For scalars or strings, the proc is not called, and CosObjEnum() returns true.

• For dictionaries, proc is called for each key-value pair. The order in which the key-value pairs are enumerated is undefined.

• For arrays, proc is called with each element as the first paramater to proc, and the NULL object as the second parameter. Array elements are enumerated in ascending order of index.

• For streams, proc is called once, with the stream's dictionary as the first parameter to the proc and the NULL object as the second parameter.

Equals

override bool Equals(object obj)

Parameters

obj: object

Returns:

override bool

Get

Parameters

key: PDFName

A PDFName for the key

Returns:

PDFObject

A PDFObject matching the key

Returns the object matching the given key.

Exceptions

ApplicationException
—

if no matching key was found

Get

PDFObject Get(string key)

Parameters

key: string

A string representing the name for the key

Returns:

PDFObject

A PDFObject matching the key

Returns the object matching the given key string.

Exceptions

ApplicationException
—

if no matching key was found

Put

void Put(PDFName key, PDFObject obj)

Parameters

key: PDFName

A PDFName for the key

obj: PDFObject

A PDFObject to add to the dictionary

Returns:

void

Puts an object with the matching key into the dictionary, adding the entry if the key is not already present.

Put

void Put(string key, PDFObject obj)

Parameters

key: string

A string representing the name for the key

obj: PDFObject

A PDFObject to add to the dictionary

Returns:

void

Puts an object with the matching key string into the dictionary, adding the entry if the key is not already present.

Remove

void Remove(PDFName key)

Parameters

key: PDFName

A PDFName for the key

Returns:

void

Removes a key/object pair from the dictionary.

Exceptions

ApplicationException
—

if no matching key was found

Remove

void Remove(string key)

Parameters

key: string

A string representing the name for the key

Returns:

void

Removes a key/object pair from the dictionary.

Exceptions

ApplicationException
—

if no matching key was found

ToString

override string ToString()

Returns:

override string

A string describing this PDFDict and its properties.

Returns a string representation of this PDFDict.