Foxit PDF SDK

Public Member Functions | Static Public Member Functions | List of all members
com.foxit.sdk.pdf.objects.PDFDictionary Class Reference
Inheritance diagram for com.foxit.sdk.pdf.objects.PDFDictionary:

## Public Member Functions
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
PDFObject | getElement (String key) throws com.foxit.sdk.PDFException
| Get the value element of an entry with specified key. More...
String | getKey (long position) throws com.foxit.sdk.PDFException
| Get the key of an entry specified by position. More...
PDFObject | getValue (long position) throws com.foxit.sdk.PDFException
| Get the value element of an entry specified by position. More...
boolean | hasKey (String key) throws com.foxit.sdk.PDFException
| Check whether there is an entry with specified key in current dictionary or not. More...
long | moveNext (long position) throws com.foxit.sdk.PDFException
| Move to the position of first or the next entry. More...
void | removeAt (String key) throws com.foxit.sdk.PDFException
| Remove an entry specified by key. More...
void | setAt (String key, PDFObject pdf_object) throws com.foxit.sdk.PDFException
| 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 (String key, boolean value) throws com.foxit.sdk.PDFException
| Set boolean element an entry specified by key. More...
void | setAtDateTime (String key, DateTime value) throws com.foxit.sdk.PDFException
| Set a Datetime object as value element to an entry specified by key. More...
void | setAtFloat (String key, float value) throws com.foxit.sdk.PDFException
| Set a float element to an entry specified by key. More...
void | setAtInteger (String key, int value) throws com.foxit.sdk.PDFException
| Set a integer element to an entry specified by key. More...
void | setAtMatrix (String key, Matrix2D value) throws com.foxit.sdk.PDFException
| Set a matrix object as value element to an entry specified by key. More...
void | setAtName (String key, String value) throws com.foxit.sdk.PDFException
| Set a string (as PDF name object) as value element to an entry specified by key. More...
void | setAtRect (String key, RectF value) throws com.foxit.sdk.PDFException
| Set a rectangle object as value element to an entry specified by key. More...
void | setAtReference (String key, PDFObject pdf_object, PDFDoc document) throws com.foxit.sdk.PDFException
| 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 (String key, String value) throws com.foxit.sdk.PDFException
| Set a string as value element to an entry specified by key. More...
Public Member Functions inherited from com.foxit.sdk.pdf.objects.PDFObject
PDFObject | cloneObject ()
| Clone current PDF object and get the cloned PDF object. More...
PDFObject | deepCloneObject ()
| Clone current PDF object and get the cloned PDF object. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
PDFArray | getArray ()
| Get the PDF array object of current PDF object. More...
boolean | getBoolean () throws com.foxit.sdk.PDFException
| Get the boolean value of current PDF object. More...
DateTime | getDateTime () throws com.foxit.sdk.PDFException
| Get the date time value of current PDF object. More...
PDFDictionary | getDict ()
| Get the PDF dictionary object of current PDF object. More...
PDFObject | getDirectObject ()
| Get the direct object of current PDF object. More...
float | getFloat () throws com.foxit.sdk.PDFException
| Get the float value of current PDF object. More...
int | getInteger () throws com.foxit.sdk.PDFException
| Get the integer value of current PDF object. More...
Matrix2D | getMatrix () throws com.foxit.sdk.PDFException
| Get the matrix value of current PDF object. More...
String | getName () throws com.foxit.sdk.PDFException
| Get the name value of current PDF object. More...
int | getObjNum ()
| Get the indirect object number of current PDF object. More...
RectF | getRect () throws com.foxit.sdk.PDFException
| Get the rectangle value of current PDF object. More...
PDFStream | getStream ()
| Get the PDF stream object of current PDF object. More...
byte [] | getString ()
| Get the string value of current PDF object. More...
int | getType ()
| Get the type of current PDF object. More...
String | getWideString ()
| Get the wide string value of current PDF object. More...
boolean | isIdentical (PDFObject pdf_obj)
| Check if input PDF object is identical with current PDF object. More...
void | release ()
| 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...

## Static Public Member Functions
static PDFDictionary | create () throws com.foxit.sdk.PDFException
| Create a new dictionary object. More...
Static Public Member Functions inherited from com.foxit.sdk.pdf.objects.PDFObject
static PDFObject | createFromBoolean (boolean boolean_value)
| Create a PDF object from a boolean value. More...
static PDFObject | createFromDateTime (DateTime date_time)
| Create a PDF object from date time. More...
static PDFObject | createFromFloat (float float_value)
| Create a PDF object from a float number. More...
static PDFObject | createFromInteger (int integer_value)
| Create a PDF object from a integer number. More...
static PDFObject | createFromName (String name)
| Create a PDF object from a string which represents a name. More...
static PDFObject | createFromNameW (String name)
| Create a PDF object from a string which represents a name. More...
static PDFObject | createFromString (String string_value)
| Create a PDF object from string. More...
static PDFObject | createFromString (String string_value, int length)
| Create a PDF object from string. More...
static PDFObject | createReference (PDFDoc document, int object_number)
| Create a reference for an indirect object. More...

## Additional Inherited Members
Static Public Attributes inherited from com.foxit.sdk.pdf.objects.PDFObject
static final int | e_Array = 5
| PDF array object.
static final int | e_Boolean = 1
| PDF boolean object.
static final int | e_Dictionary = 6
| PDF dictionary object.
static final int | e_InvalidType = 0
| Invalid PDF object type.
static final int | e_Name = 4
| PDF name object.
static final int | e_Null = 8
| PDF null object.
static final int | e_Number = 2
| PDF number object.
static final int | e_Reference = 9
| PDF reference object.
static final int | e_Stream = 7
| PDF stream object.
static final int | e_String = 3
| PDF string object.

## 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 com.foxit.sdk.pdf.objects.PDFDictionary is derived from PDFObject and offers functions to create a new PDF dictionary object and get/set entries in a PDF dictionary object.

See also
  PDFObject

## Member Function Documentation

## ◆ create()

static PDFDictionary com.foxit.sdk.pdf.objects.PDFDictionary.create | ( |  | ) | throws com.foxit.sdk.PDFException
| static

Create a new dictionary object.

Please call function PDFObject.release 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 PDFDictionary object. If there is any error, this function will return null.

## ◆ delete()

synchronized void com.foxit.sdk.pdf.objects.PDFDictionary.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

## ◆ getElement()

PDFObject com.foxit.sdk.pdf.objects.PDFDictionary.getElement | ( | String | key | ) | throws com.foxit.sdk.PDFException

Get the value element of an entry with specified key.

Parameters

  [in] | key | The key of the entry. It should not be an empty string.

Returns
  A PDFObject object that receives the value with specified key. If not found, this function will return null.

## ◆ getKey()

String com.foxit.sdk.pdf.objects.PDFDictionary.getKey | ( | long | position | ) | throws com.foxit.sdk.PDFException

Get the key of an entry specified by position.

Parameters

  [in] | position | A POSITION that specifies the position of the entry. It should not be null or 0.

Returns
  The key of the specified entry.

## ◆ getValue()

PDFObject com.foxit.sdk.pdf.objects.PDFDictionary.getValue | ( | long | position | ) | throws com.foxit.sdk.PDFException

Get the value element of an entry specified by position.

Parameters

  [in] | position | A POSITION that specifies the position of the entry. It should not be null or 0.

Returns
  A PDFObject that receives the value element of the specified entry. If there is any error, this function will return null.

## ◆ hasKey()

boolean com.foxit.sdk.pdf.objects.PDFDictionary.hasKey | ( | String | key | ) | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | key | The key to be checked. It should not be an empty string.

Returns
  true means the specified key exist in current dictionary, while false means not.

## ◆ moveNext()

long com.foxit.sdk.pdf.objects.PDFDictionary.moveNext | ( | long | position | ) | throws com.foxit.sdk.PDFException

Move to the position of first or the next entry.

Parameters

  [in] | position | A POSITION that indicates the position of current entry in the dictionary. If this is null 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. null or 0 means current entry is the last in the dictionary.

## ◆ removeAt()

void com.foxit.sdk.pdf.objects.PDFDictionary.removeAt | ( | String | key | ) | throws com.foxit.sdk.PDFException

Remove an entry specified by key.

Parameters

  [in] | key | The key of the entry to be removed. It should not be an empty string.

Returns
  None.

## ◆ setAt()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAt | ( | String | key,
|  | PDFObject | pdf_object
| ) |  | throws com.foxit.sdk.PDFException

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 PDFDictionary.setAtReference .

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | pdf_object | A PDFObject 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 null.

Returns
  None.

## ◆ setAtBoolean()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtBoolean | ( | String | key,
|  | boolean | value
| ) |  | throws com.foxit.sdk.PDFException

Set boolean element an entry specified by key.

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | A boolean element which will be set to the entry.

Returns
  None.

## ◆ setAtDateTime()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtDateTime | ( | String | key,
|  | DateTime | value
| ) |  | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | The date time information which will be set to the entry.

Returns
  None.

## ◆ setAtFloat()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtFloat | ( | String | key,
|  | float | value
| ) |  | throws com.foxit.sdk.PDFException

Set a float element to an entry specified by key.

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | A float value which will be set to the entry.

Returns
  None.

## ◆ setAtInteger()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtInteger | ( | String | key,
|  | int | value
| ) |  | throws com.foxit.sdk.PDFException

Set a integer element to an entry specified by key.

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | An integer value which will be set to the entry.

Returns
  None.

## ◆ setAtMatrix()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtMatrix | ( | String | key,
|  | Matrix2D | value
| ) |  | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | A matrix which will be set to the entry.

Returns
  None.

## ◆ setAtName()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtName | ( | String | key,
|  | String | value
| ) |  | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | A string which will be set as PDF name object to the entry. It should not be an empty string.

Returns
  None.

## ◆ setAtRect()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtRect | ( | String | key,
|  | RectF | value
| ) |  | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | A rectangle which will be set to the entry.

Returns
  None.

## ◆ setAtReference()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtReference | ( | String | key,
|  | PDFObject | pdf_object,
|  | PDFDoc | document
| ) |  | throws com.foxit.sdk.PDFException

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 PDFDictionary.setAt .

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | pdf_object | A PDFObject 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 null.
  [in] | document | A 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()

void com.foxit.sdk.pdf.objects.PDFDictionary.setAtString | ( | String | key,
|  | String | value
| ) |  | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | key | The key of the entry, whose value element will be set. It should not be an empty string.
  [in] | value | A wide string which will be set as PDF string object to the entry.

Returns
  None.

Note
  If to get string value, please call function PDFObject.getWideString .