Foxit PDF SDK
FSPDFDictionary Class Reference
Inheritance diagram for FSPDFDictionary:
FSPDFObject

Instance Methods

(FSPDFObject *) - getElement:
 Get the value element of an entry with specified key.
More...
 
(NSString *) - getKey:
 Get the key of an entry specified by position.
More...
 
(FSPDFObject *) - getValue:
 Get the value element of an entry specified by position.
More...
 
(BOOL) - hasKey:
 Check whether there is an entry with specified key in current dictionary or not.
More...
 
(long) - moveNext:
 Move to the position of first or the next entry.
More...
 
(void) - removeAt:
 Remove an entry specified by key.
More...
 
(void) - setAt:pdf_object:
 Set a direct PDF object (whose object number is always equal to 0) as value element to an entry specified by key.
More...
 
(void) - setAtBoolean:value:
 Set boolean element an entry specified by key.
More...
 
(void) - setAtDateTime:value:
 Set a Datetime object as value element to an entry specified by key.
More...
 
(void) - setAtFloat:value:
 Set a float element to an entry specified by key.
More...
 
(void) - setAtInteger:value:
 Set a integer element to an entry specified by key.
More...
 
(void) - setAtMatrix:value:
 Set a matrix object as value element to an entry specified by key.
More...
 
(void) - setAtName:value:
 Set a string (as PDF name object) as value element to an entry specified by key.
More...
 
(void) - setAtRect:value:
 Set a rectangle object as value element to an entry specified by key.
More...
 
(void) - setAtReference:pdf_object:document:
 Set the reference object of an indirect PDF object (whose object number is always above 0) as value element to an entry specified by key.
More...
 
(void) - setAtString:value:
 Set a string as value element to an entry specified by key.
More...
 
- Instance Methods inherited from FSPDFObject
(FSPDFObject *) - cloneObject
 Clone current PDF object and get the cloned PDF object.
More...
 
(FSPDFObject *) - deepCloneObject
 Clone current PDF object and get the cloned PDF object.
More...
 
(void) - destroy
 Release a newly created PDF object or a clone PDF object, which is not related to PDF document or other PDF object and will not be used any more.
More...
 
(FSPDFArray *) - getArray
 Get the PDF array object of current PDF object.
More...
 
(BOOL) - getBoolean
 Get the boolean value of current PDF object.
More...
 
(FSDateTime *) - getDateTime
 Get the date time value of current PDF object.
More...
 
(FSPDFDictionary *) - getDict
 Get the PDF dictionary object of current PDF object.
More...
 
(FSPDFObject *) - getDirectObject
 Get the direct object of current PDF object.
More...
 
(float) - getFloat
 Get the float value of current PDF object.
More...
 
(int) - getInteger
 Get the integer value of current PDF object.
More...
 
(FSMatrix2D *) - getMatrix
 Get the matrix value of current PDF object.
More...
 
(NSString *) - getName
 Get the name value of current PDF object.
More...
 
(unsigned int) - getObjNum
 Get the indirect object number of current PDF object.
More...
 
(FSRectF *) - getRect
 Get the rectangle value of current PDF object.
More...
 
(FSPDFStream *) - getStream
 Get the PDF stream object of current PDF object.
More...
 
(NSData *) - getString
 Get the string value of current PDF object.
More...
 
(FSPDFObjectType- getType
 Get the type of current PDF object.
More...
 
(NSString *) - getWideString
 Get the wide string value of current PDF object.
More...
 
(BOOL) - isIdentical:
 Check if input PDF object is identical with current PDF object.
More...
 

Class Methods

(FSPDFDictionary *) + create
 Create a new dictionary object.
More...
 
- Class Methods inherited from FSPDFObject
(FSPDFObject *) + createFromBoolean:
 Create a PDF object from a boolean value.
More...
 
(FSPDFObject *) + createFromDateTime:
 Create a PDF object from date time.
More...
 
(FSPDFObject *) + createFromFloat:
 Create a PDF object from a float number.
More...
 
(FSPDFObject *) + createFromInteger:
 Create a PDF object from a integer number.
More...
 
(FSPDFObject *) + createFromName:
 Create a PDF object from a string which represents a name.
More...
 
(FSPDFObject *) + createFromString:
 Create a PDF object from string.
More...
 
(FSPDFObject *) + createReference:object_number:
 Create a reference for an indirect object.
More...
 

Detailed Description

A PDF dictionary object is an associative table containing pairs of objects, known as entries of the dictionary. The first element of each entry is the key, and it must be a PDF name object. The second element is the value, and it can be any kind of PDF object, including another dictionary. In the same dictionary, no two entries should have the same key. For more details, please refer to Section 3.2.6 "Dictionary Objects" in <PDF Reference 1.7>.
Class FSPDFDictionary is derived from FSPDFObject and offers functions to create a new PDF dictionary object and get/set entries in a PDF dictionary object.

See also
FSPDFObject

Method Documentation

◆ create()

+ (FSPDFDictionary *) create

Create a new dictionary object.

Please call function FSPDFObject::destroy to release the created object if it has not been added/set into PDF document or other PDF object and will not be used any more.

Returns
A new FSPDFDictionary object. If there is any error, this function will return nil.

◆ getElement:()

- (FSPDFObject *) getElement: (NSString *)  key

Get the value element of an entry with specified key.

Parameters
[in]keyThe key of the entry. It should not be an empty string.
Returns
A FSPDFObject object that receives the value with specified key. If not found, this function will return nil.

◆ getKey:()

- (NSString *) getKey: (long)  position

Get the key of an entry specified by position.

Parameters
[in]positionA POSITION that specifies the position of the entry. It should not be nil or 0.
Returns
The key of the specified entry.

◆ getValue:()

- (FSPDFObject *) getValue: (long)  position

Get the value element of an entry specified by position.

Parameters
[in]positionA POSITION that specifies the position of the entry. It should not be nil or 0.
Returns
A FSPDFObject that receives the value element of the specified entry. If there is any error, this function will return nil.

◆ hasKey:()

- (BOOL) hasKey: (NSString *)  key

Check whether there is an entry with specified key in current dictionary or not.

Parameters
[in]keyThe key to be checked. It should not be an empty string.
Returns
YES means the specified key exist in current dictionary, while NO means not.

◆ moveNext:()

- (long) moveNext: (long)  position

Move to the position of first or the next entry.

Parameters
[in]positionA POSITION that indicates the position of current entry in the dictionary. If this is nil or 0, the position of first entry in the dictionary will be returned.
Returns
A POSITION that represents the position of next entry in the dictionary. nil or 0 means current entry is the last in the dictionary.

◆ removeAt:()

- (void) removeAt: (NSString *)  key

Remove an entry specified by key.

Parameters
[in]keyThe key of the entry to be removed. It should not be an empty string.
Returns
None.

◆ setAt:pdf_object:()

- (void) setAt: (NSString *)  key
pdf_object: (FSPDFObject*)  pdf_object 

Set a direct PDF object (whose object number is always equal to 0) as value element to an entry specified by key.

If user wants to set indirect PDF object (whose object number is always above 0) to an entry, please refer to function FSPDFDictionary::setAtReference:pdf_object:document:.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]pdf_objectA FSPDFObject object which is a direct PDF object (whose object number is always equal to 0) and will be set to the entry. It should not be nil.
Returns
None.

◆ setAtBoolean:value:()

- (void) setAtBoolean: (NSString *)  key
value: (BOOL)  value 

Set boolean element an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueA boolean element which will be set to the entry.
Returns
None.

◆ setAtDateTime:value:()

- (void) setAtDateTime: (NSString *)  key
value: (FSDateTime*)  value 

Set a Datetime object as value element to an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueThe date time information which will be set to the entry.
Returns
None.

◆ setAtFloat:value:()

- (void) setAtFloat: (NSString *)  key
value: (float)  value 

Set a float element to an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueA float value which will be set to the entry.
Returns
None.

◆ setAtInteger:value:()

- (void) setAtInteger: (NSString *)  key
value: (int)  value 

Set a integer element to an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueAn integer value which will be set to the entry.
Returns
None.

◆ setAtMatrix:value:()

- (void) setAtMatrix: (NSString *)  key
value: (FSMatrix2D*)  value 

Set a matrix object as value element to an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueA matrix which will be set to the entry.
Returns
None.

◆ setAtName:value:()

- (void) setAtName: (NSString *)  key
value: (NSString *)  value 

Set a string (as PDF name object) as value element to an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueA string which will be set as PDF name object to the entry. It should not be an empty string.
Returns
None.

◆ setAtRect:value:()

- (void) setAtRect: (NSString *)  key
value: (FSRectF*)  value 

Set a rectangle object as value element to an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueA rectangle which will be set to the entry.
Returns
None.

◆ setAtReference:pdf_object:document:()

- (void) setAtReference: (NSString *)  key
pdf_object: (FSPDFObject*)  pdf_object
document: (FSPDFDoc*)  document 

Set the reference object of an indirect PDF object (whose object number is always above 0) as value element to an entry specified by key.

If user wants to set direct PDF object (whose object number is always equal to 0) to an entry, please refer to function FSPDFDictionary::setAt:pdf_object:.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]pdf_objectA FSPDFObject object which is an indirect PDF object (whose object number is always above 0) and will be set to the entry by a reference object which refers to this indirect object. It should not be nil.
[in]documentA valid PDF document object, to which current PDF dictionary object belongs and in which parameter pdf_object is or will be an indirect object.
Returns
None.

◆ setAtString:value:()

- (void) setAtString: (NSString *)  key
value: (NSString *)  value 

Set a string as value element to an entry specified by key.

Parameters
[in]keyThe key of the entry, whose value element will be set. It should not be an empty string.
[in]valueA wide string which will be set as PDF string object to the entry.
Returns
None.
Note
If to get string value, please call function FSPDFObject::getWideString.