com.foxit.sdk.pdf.objects.PDFObject Class Reference
Inheritance diagram for com.foxit.sdk.pdf.objects.PDFObject:
com.foxit.sdk.pdf.objects.PDFArray com.foxit.sdk.pdf.objects.PDFDictionary com.foxit.sdk.pdf.objects.PDFStream

Public Member Functions

PDFObject cloneObject ()
 Clone current PDF object and get the cloned PDF object.
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...
 
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 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 createFromString (String string_value)
 Create a PDF object from string.
More...
 
static PDFObject createReference (PDFDoc document, int object_number)
 Create a reference for an indirect object.
More...
 

Static Public Attributes

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

PDF supports eight basic types of objects:
"Boolean value", "Integer and real number", "String", "Name", "Array", "Dictionary", "Stream", "The null object". For more details about PDF objects, please refer to Section 3.2 "Objects" in <PDF Reference 1.7>.
Class PDFObject is a base class for all kinds of PDF objects. It offers different functions to create different kind of PDF objects. For "Array", "Dictionary" and "Stream" PDF object, please refer to derived classes PDFArray, PDFDictionary and PDFStream.
If user wants to make a newly created PDF object to be an indirect object, please call function pdf::PDFDoc::addIndirectObject.

See also
PDFArray
PDFDictionary
PDFStream
pdf::PDFDoc

Member Function Documentation

◆ cloneObject()

PDFObject com.foxit.sdk.pdf.objects.PDFObject.cloneObject ( )

Clone current PDF object and get the cloned PDF object.

Returns
A new PDFObject object as the clone result. Please call PDFObject::release to release the new object if it has not been added/set into PDF document or other PDF object and will not be used any more.

◆ createFromBoolean()

static PDFObject com.foxit.sdk.pdf.objects.PDFObject.createFromBoolean ( boolean  boolean_value)
static

Create a PDF object from a boolean value.

Parameters
boolean_valueA boolean value.
Returns
A new PDFObject object, whose object type is e_Boolean. 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.

◆ createFromDateTime()

static PDFObject com.foxit.sdk.pdf.objects.PDFObject.createFromDateTime ( DateTime  date_time)
static

Create a PDF object from date time.

PDF defines a standard date format, which closely follows that of the international standard ASN.1 (Abstract Syntax Notation One), defined in ISO/ IEC 8824 (see the Bibliography). A date is defined as an ASCII string of the form (D:YYYYMMDDHHmmSSOHH'mm').

Parameters
date_timeA DateTime object.
Returns
A new PDFObject object, whose object type is e_String. 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.

◆ createFromFloat()

static PDFObject com.foxit.sdk.pdf.objects.PDFObject.createFromFloat ( float  float_value)
static

Create a PDF object from a float number.

Parameters
float_valueA float value.
Returns
A new PDFObject object, whose object type is e_Number. 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.

◆ createFromInteger()

static PDFObject com.foxit.sdk.pdf.objects.PDFObject.createFromInteger ( int  integer_value)
static

Create a PDF object from a integer number.

Parameters
integer_valueAn integer value.
Returns
A new PDFObject object, whose object type is e_Number. 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.

◆ createFromName()

static PDFObject com.foxit.sdk.pdf.objects.PDFObject.createFromName ( String  name)
static

Create a PDF object from a string which represents a name.

Parameters
nameA string. It should not be an empty string.
Returns
A new PDFObject object, whose object type is e_Name. 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.

◆ createFromString()

static PDFObject com.foxit.sdk.pdf.objects.PDFObject.createFromString ( String  string_value)
static

Create a PDF object from string.

Parameters
string_valueA string. It should not be an empty string.
Returns
A PDFObject object, whose object type is e_String. 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.

◆ createReference()

static PDFObject com.foxit.sdk.pdf.objects.PDFObject.createReference ( PDFDoc  document,
int  object_number 
)
static

Create a reference for an indirect object.

The indirect object can be retrieved by following methods:


Returned by function pdf::PDFDoc::getIndirectObject.
Returned by function pdf::PDFDoc::addIndirectObject, when try to add a direct PDF object to PDF document and make it to be an indirect object.

Parameters
documentA valid PDF document object.
object_numberThe indirect object number of the indirect PDF object. This should be above 0.
Returns
A new PDFObject object, whose object type is e_Reference. 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.

◆ getArray()

PDFArray com.foxit.sdk.pdf.objects.PDFObject.getArray ( )

Get the PDF array object of current PDF object.

If the type of current PDF object is e_Reference, this function will check the direct PDF object of current PDF object.

Returns
A PDF array object. If current PDF object or the direct PDF object is not a PDF array, null will be returned.

◆ getBoolean()

boolean com.foxit.sdk.pdf.objects.PDFObject.getBoolean ( ) throws com.foxit.sdk.PDFException

Get the boolean value of current PDF object.

Only useful when the type of current PDF object is e_Boolean.

Returns
The boolean value. For PDF object in other type, FALSE will be returned.

◆ getDateTime()

DateTime com.foxit.sdk.pdf.objects.PDFObject.getDateTime ( ) throws com.foxit.sdk.PDFException

Get the date time value of current PDF object.

Only useful when the type of current PDF objec is e_String and its content is in PDF standard date format.

Returns
The data time information. If there is any error or current object is in other type, an empty DateTime object will be returned.

◆ getDict()

PDFDictionary com.foxit.sdk.pdf.objects.PDFObject.getDict ( )

Get the PDF dictionary object of current PDF object.

If the type of current PDF object is e_Reference, this function will check the direct PDF object of current PDF object.

Returns
A PDF dictionary object. If current PDF object or the direct PDF object is not a PDF dictionary, null will be returned.

◆ getDirectObject()

PDFObject com.foxit.sdk.pdf.objects.PDFObject.getDirectObject ( )

Get the direct object of current PDF object.

If the type of current PDF object is e_Reference, the direct object will be returned.

Returns
The direct PDF object. For PDF object in other type, this function will return current PDF object itself.

◆ getFloat()

float com.foxit.sdk.pdf.objects.PDFObject.getFloat ( ) throws com.foxit.sdk.PDFException

Get the float value of current PDF object.

Only useful when the type of current PDF object is e_Number.

Returns
The float value. For PDF object in other type, 0.0f will be returned.

◆ getInteger()

int com.foxit.sdk.pdf.objects.PDFObject.getInteger ( ) throws com.foxit.sdk.PDFException

Get the integer value of current PDF object.

Only useful when the type of current PDF object is e_Number.

Returns
The integer value. For PDF object in other type, 0 will be returned.

◆ getMatrix()

Matrix2D com.foxit.sdk.pdf.objects.PDFObject.getMatrix ( ) throws com.foxit.sdk.PDFException

Get the matrix value of current PDF object.

Only useful for PDF object whose type is e_Array and it has 6 number objects as elements.

Returns
A matrix. If there is any error or current object is in other type, a matrix with value [0 0 0 0 0 0] will be returned.

◆ getName()

String com.foxit.sdk.pdf.objects.PDFObject.getName ( ) throws com.foxit.sdk.PDFException

Get the name value of current PDF object.

Only useful when the type of current PDF object is e_Name or e_String.

Returns
A string that represents the value. If there is any error or current object is in other type, an empty string will be returned.

◆ getObjNum()

int com.foxit.sdk.pdf.objects.PDFObject.getObjNum ( )

Get the indirect object number of current PDF object.

Returns
The indirect object number. It would be:

0 if current PDF object is a direct object.
above 0 if current PDF object is an indirect object.
-1 means there is any error.

◆ getRect()

RectF com.foxit.sdk.pdf.objects.PDFObject.getRect ( ) throws com.foxit.sdk.PDFException

Get the rectangle value of current PDF object.

Only useful for PDF object whose type is e_Array and it has 4 number objects as elements.

Returns
A rectangle. If there is any error or current object is in other type, a rectangle with value [0 0 0 0] will be returned.

◆ getStream()

PDFStream com.foxit.sdk.pdf.objects.PDFObject.getStream ( )

Get the PDF stream object of current PDF object.

If the type of current PDF object is e_Reference, this function will check the direct PDF object of current PDF object.

Returns
A PDF stream object. If current PDF object or the direct PDF object is not a PDF stream, null will be returned.

◆ getString()

byte[] com.foxit.sdk.pdf.objects.PDFObject.getString ( )

Get the string value of current PDF object.

This function will get the string format for actual value of current PDF object:


If object type is e_Boolean, "true" or "false" string value will be returned, depending on its actual value.
If object type is e_Number, the value will be represents as a string. For example, "1.5" string is for value 1.5.
If object type is e_String, the string value will be retrieved directly.
If value of current PDF object cannot be converted to a valid string, an empty string will be returned.

Returns
A string.

◆ getType()

int com.foxit.sdk.pdf.objects.PDFObject.getType ( )

Get the type of current PDF object.

Returns
PDF object type. Please refer to values starting from e_Boolean and this would be one of these values.

◆ getWideString()

String com.foxit.sdk.pdf.objects.PDFObject.getWideString ( )

Get the wide string value of current PDF object.

This function will get the string format for actual value of current PDF object:


If object type is e_Boolean, "true" or "false" string value will be returned, depending on its actual value.
If object type is e_Number, the value will be represents as a string. For example, "1.5" string is for value 1.5.
If object type is e_String, the string value will be retrieved directly.
If value of current PDF object cannot be converted to a valid string, an empty string will be returned.

Returns
A string.

◆ release()

void com.foxit.sdk.pdf.objects.PDFObject.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.

This function should be called only for a newly created PDF object or a cloned PDF object, which has not been added or set to other PDF object or related to PDF document, and will not be used any more. Please do not use this function for other case, otherwise unknown error may occur.

Returns
None.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.