Foxit PDF SDK
fsdk.PDFObject Class Reference

Public Member Functions

def CloneObject ()
 Clone current PDF object and get the cloned PDF object.
More...
 
def DeepCloneObject ()
 Clone current PDF object and get the cloned PDF object.
More...
 
def GetArray ()
 Get the PDF array object of current PDF object.
More...
 
def GetBoolean ()
 Get the boolean value of current PDF object.
More...
 
def GetDateTime ()
 Get the date time value of current PDF object.
More...
 
def GetDict ()
 Get the PDF dictionary object of current PDF object.
More...
 
def GetDirectObject ()
 Get the direct object of current PDF object.
More...
 
def GetFloat ()
 Get the float value of current PDF object.
More...
 
def GetInteger ()
 Get the integer value of current PDF object.
More...
 
def GetMatrix ()
 Get the matrix value of current PDF object.
More...
 
def GetName ()
 Get the name value of current PDF object.
More...
 
def GetObjNum ()
 Get the indirect object number of current PDF object.
More...
 
def GetRect ()
 Get the rectangle value of current PDF object.
More...
 
def GetStream ()
 Get the PDF stream object of current PDF object.
More...
 
def GetString ()
 Get the string value of current PDF object.
More...
 
def GetType ()
 Get the type of current PDF object.
More...
 
def GetWideString ()
 Get the wide string value of current PDF object.
More...
 
def IsIdentical (pdf_obj)
 Check if input PDF object is identical with current PDF object.
More...
 
def 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...
 

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 fsdk.PDFArray , fsdk.PDFDictionary and PDFStream .
If user wants to make a newly created PDF object to be an indirect object, please call function fsdk.PDFDoc.AddIndirectObject .

See also
PDFArray
PDFDictionary
PDFStream
fsdk.PDFDoc

Member Function Documentation

◆ CloneObject()

def fsdk.PDFObject.CloneObject ( )

Clone current PDF object and get the cloned PDF object.

Please call fsdk.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.

Returns
A new PDFObject object as the clone result. If there is any error, this function will return null.

◆ DeepCloneObject()

def fsdk.PDFObject.DeepCloneObject ( )

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. Please call fsdk.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.

Returns
A new PDFObject object as the clone result. If there is any error, this function will return null.

◆ GetArray()

def fsdk.PDFObject.GetArray ( )

Get the PDF array object of current PDF object.

If the type of current PDF object is fsdk.PDFObjectE_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()

def fsdk.PDFObject.GetBoolean ( )

Get the boolean value of current PDF object.

Only useful when the type of current PDF object is fsdk.PDFObjectE_Boolean .

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

◆ GetDateTime()

def fsdk.PDFObject.GetDateTime ( )

Get the date time value of current PDF object.

Only useful when the type of current PDF objec is fsdk.PDFObjectE_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()

def fsdk.PDFObject.GetDict ( )

Get the PDF dictionary object of current PDF object.

If the type of current PDF object is fsdk.PDFObjectE_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()

def fsdk.PDFObject.GetDirectObject ( )

Get the direct object of current PDF object.

If the type of current PDF object is fsdk.PDFObjectE_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. If there is any error, this function will return null.

◆ GetFloat()

def fsdk.PDFObject.GetFloat ( )

Get the float value of current PDF object.

Only useful when the type of current PDF object is fsdk.PDFObjectE_Number .

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

◆ GetInteger()

def fsdk.PDFObject.GetInteger ( )

Get the integer value of current PDF object.

Only useful when the type of current PDF object is fsdk.PDFObjectE_Number .

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

◆ GetMatrix()

def fsdk.PDFObject.GetMatrix ( )

Get the matrix value of current PDF object.

Only useful for PDF object whose type is fsdk.PDFObjectE_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()

def fsdk.PDFObject.GetName ( )

Get the name value of current PDF object.

Only useful when the type of current PDF object is fsdk.PDFObjectE_Name or fsdk.PDFObjectE_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()

def fsdk.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()

def fsdk.PDFObject.GetRect ( )

Get the rectangle value of current PDF object.

Only useful for PDF object whose type is fsdk.PDFObjectE_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()

def fsdk.PDFObject.GetStream ( )

Get the PDF stream object of current PDF object.

If the type of current PDF object is fsdk.PDFObjectE_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()

def fsdk.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 value of current PDF object cannot be converted to a valid string, an empty string will be returned.

Returns
A string.

◆ GetType()

def fsdk.PDFObject.GetType ( )

Get the type of current PDF object.

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

◆ GetWideString()

def fsdk.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 value of current PDF object cannot be converted to a valid string, an empty string will be returned.

Returns
A string.

◆ IsIdentical()

def fsdk.PDFObject.IsIdentical (   pdf_obj)

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()

def fsdk.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.