Foxit PDF SDK
foxit.pdf.objects.PDFObject Class Reference
Inheritance diagram for foxit.pdf.objects.PDFObject:
foxit.pdf.objects.PDFArray foxit.pdf.objects.PDFDictionary foxit.pdf.objects.PDFStream

Public Types

enum  Type {
  Type.e_InvalidType = 0, Type.e_Boolean = 1, Type.e_Number = 2, Type.e_String = 3,
  Type.e_Name = 4, Type.e_Array = 5, Type.e_Dictionary = 6, Type.e_Stream = 7,
  Type.e_Null = 8, Type.e_Reference = 9
}
 Enumeration for PDF object type.
More...
 

Public Member Functions

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...
 
PDFArray GetArray ()
 Get the PDF array object of current PDF object.
More...
 
bool GetBoolean ()
 Get the boolean value of current PDF object.
More...
 
DateTime GetDateTime ()
 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 ()
 Get the float value of current PDF object.
More...
 
int GetInteger ()
 Get the integer value of current PDF object.
More...
 
Matrix2D GetMatrix ()
 Get the matrix value of current PDF object.
More...
 
string GetName ()
 Get the name value of current PDF object.
More...
 
int GetObjNum ()
 Get the indirect object number of current PDF object.
More...
 
RectF GetRect ()
 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...
 
PDFObject.Type GetType ()
 Get the type of current PDF object.
More...
 
string GetWideString ()
 Get the wide string value of current PDF object.
More...
 
bool 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 PDFObject CreateFromBoolean (bool 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...
 

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 foxit.pdf.objects.PDFArray , foxit.pdf.objects.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
foxit.pdf.PDFDoc

Member Enumeration Documentation

◆ Type

Enumeration for PDF object type.

Values of this enumeration should be used alone.

Enumerator
e_InvalidType 

Invalid PDF object type.

e_Boolean 

PDF boolean object.

e_Number 

PDF number object.

e_String 

PDF string object.

e_Name 

PDF name object.

e_Array 

PDF array object.

e_Dictionary 

PDF dictionary object.

e_Stream 

PDF stream object.

e_Null 

PDF null object.

e_Reference 

PDF reference object.

Member Function Documentation

◆ CloneObject()

PDFObject foxit.pdf.objects.PDFObject.CloneObject ( )
inline

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 foxit.pdf.objects.PDFObject.CreateFromBoolean ( bool  boolean_value)
inlinestatic

Create a PDF object from a boolean value.

Parameters
[in]boolean_valueA boolean value.
Returns
A new PDFObject object, whose object type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.CreateFromDateTime ( DateTime  date_time)
inlinestatic

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
[in]date_timeA date and time object.
Returns
A new PDFObject object, whose object type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.CreateFromFloat ( float  float_value)
inlinestatic

Create a PDF object from a float number.

Parameters
[in]float_valueA float value.
Returns
A new PDFObject object, whose object type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.CreateFromInteger ( int  integer_value)
inlinestatic

Create a PDF object from a integer number.

Parameters
[in]integer_valueAn integer value.
Returns
A new PDFObject object, whose object type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.CreateFromName ( string  name)
inlinestatic

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

Parameters
[in]nameA string. It should not be an empty string.
Returns
A new PDFObject object, whose object type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.CreateFromString ( string  string_value)
inlinestatic

Create a PDF object from string.

Parameters
[in]string_valueA string. It should not be an empty string.
Returns
A PDFObject object, whose object type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.CreateReference ( PDFDoc  document,
int  object_number 
)
inlinestatic

Create a reference for an indirect object.

The indirect object can be retrieved by following methods:


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

◆ DeepCloneObject()

PDFObject foxit.pdf.objects.PDFObject.DeepCloneObject ( )
inline

Clone current PDF object and get the cloned PDF object.

This function is a totally direct copy, without any reference object inside, so the copy object can be copied to another document.

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.

◆ GetArray()

PDFArray foxit.pdf.objects.PDFObject.GetArray ( )
inline

Get the PDF array object of current PDF object.

If the type of current PDF object is foxit.pdf.objects.PDFObject.Type.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()

bool foxit.pdf.objects.PDFObject.GetBoolean ( )
inline

Get the boolean value of current PDF object.

Only useful when the type of current PDF object is foxit.pdf.objects.PDFObject.Type.e_Boolean .

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

◆ GetDateTime()

DateTime foxit.pdf.objects.PDFObject.GetDateTime ( )
inline

Get the date time value of current PDF object.

Only useful when the type of current PDF objec is foxit.pdf.objects.PDFObject.Type.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 date and time object will be returned.

◆ GetDict()

PDFDictionary foxit.pdf.objects.PDFObject.GetDict ( )
inline

Get the PDF dictionary object of current PDF object.

If the type of current PDF object is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.GetDirectObject ( )
inline

Get the direct object of current PDF object.

If the type of current PDF object is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.GetFloat ( )
inline

Get the float value of current PDF object.

Only useful when the type of current PDF object is foxit.pdf.objects.PDFObject.Type.e_Number .

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

◆ GetInteger()

int foxit.pdf.objects.PDFObject.GetInteger ( )
inline

Get the integer value of current PDF object.

Only useful when the type of current PDF object is foxit.pdf.objects.PDFObject.Type.e_Number .

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

◆ GetMatrix()

Matrix2D foxit.pdf.objects.PDFObject.GetMatrix ( )
inline

Get the matrix value of current PDF object.

Only useful for PDF object whose type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.GetName ( )
inline

Get the name value of current PDF object.

Only useful when the type of current PDF object is foxit.pdf.objects.PDFObject.Type.e_Name or foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.GetObjNum ( )
inline

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 foxit.pdf.objects.PDFObject.GetRect ( )
inline

Get the rectangle value of current PDF object.

Only useful for PDF object whose type is foxit.pdf.objects.PDFObject.Type.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 foxit.pdf.objects.PDFObject.GetStream ( )
inline

Get the PDF stream object of current PDF object.

If the type of current PDF object is foxit.pdf.objects.PDFObject.Type.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[] foxit.pdf.objects.PDFObject.GetString ( )
inline

Get the string value of current PDF object.

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

If value of current PDF object cannot be converted to a valid string, an empty string will be returned.

Returns
A string.

◆ GetType()

PDFObject.Type foxit.pdf.objects.PDFObject.GetType ( )
inline

Get the type of current PDF object.

Returns
PDF object type. Please refer to values starting from foxit.pdf.objects.PDFObject.Type.e_Boolean and this would be one of these values.

◆ GetWideString()

string foxit.pdf.objects.PDFObject.GetWideString ( )
inline

Get the wide string value of current PDF object.

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

If value of current PDF object cannot be converted to a valid string, an empty string will be returned.

Returns
A string.

◆ IsIdentical()

bool foxit.pdf.objects.PDFObject.IsIdentical ( PDFObject  pdf_obj)
inline

Check if input PDF object is identical with current PDF object.

Parameters
[in]pdf_objAnother PDF object which is to be check with current PDF object.
Returns
true means input PDF object is identical with current PDF object, while false means input PDF object is not identical with current PDF object.

◆ Release()

void foxit.pdf.objects.PDFObject.Release ( )
inline

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.