Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
FoxitPDFSDKPython3.GraphicsObjects Class Reference
Inheritance diagram for FoxitPDFSDKPython3.GraphicsObjects:

## Public Member Functions
def | GraphicsObjects (other)
| Constructor, with another GraphicsObjects object. More...
def | GenerateContent ()
| Generate contents of current graphics objects. More...
def | GenerateContent (text_merge_option)
| Generate contents of current graphics objects. More...
def | GetFirstGraphicsObjectPosition (filter)
| Get the position of first graphics object in graphics object list, based on type filter. More...
def | GetGraphicsObject (position)
| Get the graphics object by position in graphics object list. More...
def | GetGraphicsObject (index)
| Get a graphics object by index. More...
def | GetGraphicsObjectCount ()
| Get the count of graphics objects in graphics object list. More...
def | GetGraphicsObjectIndex (graphics_object)
| Get the index of a specified graphics object in graphics object list. More...
def | GetGraphicsObjectPosition (graphics_object)
| Get the position of the specified graphics object. More...
def | GetLastGraphicsObjectPosition (filter)
| Get the position of last graphics object in graphics object list, based on type filter. More...
def | GetNextGraphicsObjectPosition (position, filter)
| Get the position of next graphics object in graphics object list, based on type filter and specified current position. More...
def | GetPrevGraphicsObjectPosition (position, filter)
| Get the position of previous graphics object in graphics object list, based on type filter and specified current position. More...
def | InsertGraphicsObject (position_insert_after, graphics_object)
| Insert a graphics object after the specified position. More...
def | IsEmpty ()
| Check whether current object is empty or not. More...
def | MoveGraphicsObjectByPosition (current_position, position_move_after)
| Move a graphics object from a position to another position. More...
def | RemoveGraphicsObject (graphics_object)
| Remove a graphics object. More...
def | RemoveGraphicsObjectByPosition (position)
| Remove a graphics object by position. More...

## Static Public Attributes
| e_TextMergeBTET = _fsdk.GraphicsObjects_e_TextMergeBTET
| Merge consecutive BTETs as a new one. More...
| e_TextMergeNone = _fsdk.GraphicsObjects_e_TextMergeNone
| No text merge.
| e_TextMergeTJY = _fsdk.GraphicsObjects_e_TextMergeTJY
| Merge consecutive text-showing operators with equal y coordinates.

## Detailed Description

This class is used as a manager for graphics objects. It stores all its graphics objects in a graphics list, and use POSITION object to enumerate them. A valid POSITION object can be used to get one graphics object, insert new graphics object and even remove one.
If any graphics object is changed, or graphics object is inserted/removed, function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent should be called to ensure that all these changes would be stored to PDF document. Please refer to function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent for more details.
A PDF page's content usually consists of a sequence of graphics objects, that means PDF page is used like a manager for graphics objects as well. So class FoxitPDFSDKPython3.PDFPage is derived from class GraphicsObjects in order that class PDFPage can retrieve its graphics object.
A form XObject, a kind of graphics object, is a self-contained description of any sequence of graphics objects, so function FoxitPDFSDKPython3.FormXObject.GetGraphicsObjects can be used to retrieve a GraphicsObjects object from a form XObject in order to manage graphics objects which are contained in a form XObject.

See also
  PDFPage
  FoxitPDFSDKPython3.FormXObject
  FoxitPDFSDKPython3.GraphicsObject

## Constructor & Destructor Documentation

## ◆ GraphicsObjects()

def FoxitPDFSDKPython3.GraphicsObjects.GraphicsObjects | ( |  | other | ) |

Constructor, with another GraphicsObjects object.

Parameters

  [in] | other | Another GraphicsObjects object.

## Member Function Documentation

## ◆ GenerateContent() [1/2]

def FoxitPDFSDKPython3.GraphicsObjects.GenerateContent | ( |  | ) |

Generate contents of current graphics objects.

If any graphics object is changed, or graphics object is inserted/removed/moved, this function should be called before saving related PDF document to ensure that all these changes would be stored to PDF document. Since it may take a long time to generate content, user is not recommended to call this function frequently, but only call this function when necessary, for example, just before the related PDF document is to be saved.
When this function succeeds, and current graphics object represents a PDF page, user is recommended to re-parse the PDF page by function FoxitPDFSDKPython3.PDFPage.StartParse with parameter is_reparse true before doing some operation on page content; otherwise the result of the operation may be unexpected. For example, if render the PDF page without re-parsing PDF page after this function succeeds, the page content may not be rendered as expected or unexpected error may occur. Please refer to function FoxitPDFSDKPython3.PDFPage.StartParse for more details about re-parsing a PDF page.

Returns
  true means success, while false means failure.

## ◆ GenerateContent() [2/2]

def FoxitPDFSDKPython3.GraphicsObjects.GenerateContent | ( |  | text_merge_option | ) |

Generate contents of current graphics objects.

If any graphics object is changed, or graphics object is inserted/removed/moved, this function should be called before saving related PDF document to ensure that all these changes would be stored to PDF document. Since it may take a long time to generate content, user is not recommended to call this function frequently, but only call this function when necessary, for example, just before the related PDF document is to be saved.
When this function succeeds, and current graphics objects represent a PDF page, user is recommended to re-parse the PDF page by function FoxitPDFSDKPython3.PDFPage.StartParse with parameter is_reparse true before doing some operation on page content; otherwise the result of the operation may be unexpected. For example, if render the PDF page without re-parsing PDF page after this function succeeds, the page content may not be rendered as expected or unexpected error may occur. Please refer to function FoxitPDFSDKPython3.PDFPage.StartParse for more details about re-parsing a PDF page.

Parameters

  [in] | text_merge_option | The merge option for text object. Please refer to values starting from FoxitPDFSDKPython3.GraphicsObjects.e_TextMergeNone and this should be one of these values.

Returns
  true means success, while false means failure.

## ◆ GetFirstGraphicsObjectPosition()

def FoxitPDFSDKPython3.GraphicsObjects.GetFirstGraphicsObjectPosition | ( |  | filter | ) |

Get the position of first graphics object in graphics object list, based on type filter.

After getting a position in the graphics object list, then user can call function FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObject to get the graphics object with this position.

Parameters

  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FoxitPDFSDKPython3.GraphicsObject.e_TypeAll and this should be one of these values. FoxitPDFSDKPython3.GraphicsObject.e_TypeAll means for all kinds of graphics objects. Default value: FoxitPDFSDKPython3.GraphicsObject.e_TypeAll .

Returns
  A POSITION object that represents the position of first graphics object in graphics object list. null or 0 means there is no graphics object.

## ◆ GetGraphicsObject() [1/2]

def FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObject | ( |  | position | ) |

Get the graphics object by position in graphics object list.

Parameters

  [in] | position | A POSITION object that indicates the position in the graphics object list. It should not be null or 0.

Returns
  A FoxitPDFSDKPython3.GraphicsObject object. If there is any error, this function will return null.

## ◆ GetGraphicsObject() [2/2]

def FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObject | ( |  | index | ) |

Get a graphics object by index.

Parameters

  [in] | index | Index of a graphics object to be retrieved. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObjectCount .

Returns
  A graphics object. If there is any error, this function will return null.

## ◆ GetGraphicsObjectCount()

def FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObjectCount | ( |  | ) |

Get the count of graphics objects in graphics object list.

Returns
  Count of graphics objects in graphics object list.

## ◆ GetGraphicsObjectIndex()

def FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObjectIndex | ( |  | graphics_object | ) |

Get the index of a specified graphics object in graphics object list.

Parameters

  [in] | graphics_object | A graphics object whose index is to be retrieved. Please ensure that input graphics object belongs to current graphics objects.

Returns
  Index of specified graphics object in graphics object list. -1 means parameter graphics_object does not belong to current graphics object list.

## ◆ GetGraphicsObjectPosition()

def FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObjectPosition | ( |  | graphics_object | ) |

Get the position of the specified graphics object.

Parameters

  [in] | graphics_object | A graphics object whose position is to be retrieved.

Returns
  Position of the specified graphics object. 0 means input graphics object does not belong to current graphics objects.

## ◆ GetLastGraphicsObjectPosition()

def FoxitPDFSDKPython3.GraphicsObjects.GetLastGraphicsObjectPosition | ( |  | filter | ) |

Get the position of last graphics object in graphics object list, based on type filter.

After getting a position in the graphics object list, then user can call function FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObject to get the graphics object with this position.

Parameters

  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FoxitPDFSDKPython3.GraphicsObject.e_TypeAll and this should be one of these values. FoxitPDFSDKPython3.GraphicsObject.e_TypeAll means for all kinds of graphics objects. Default value: FoxitPDFSDKPython3.GraphicsObject.e_TypeAll .

Returns
  A POSITION object that represents the position of last graphics object in graphics object list. null or 0 means there is no graphics object.

## ◆ GetNextGraphicsObjectPosition()

def FoxitPDFSDKPython3.GraphicsObjects.GetNextGraphicsObjectPosition | ( |  | position,
|  |  | filter
| ) |  |

Get the position of next graphics object in graphics object list, based on type filter and specified current position.

After getting a position in the graphics object list, then user can call function FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObject to get the graphics object with this position.

Parameters

  [in] | position | A POSITION object that indicates a position in the graphics object list, whose next position is to be gotten. It should not be null or 0.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FoxitPDFSDKPython3.GraphicsObject.e_TypeAll and this should be one of these values. FoxitPDFSDKPython3.GraphicsObject.e_TypeAll means for all kinds of graphics objects. Default value: FoxitPDFSDKPython3.GraphicsObject.e_TypeAll .

Returns
  A POSITION object that represents the position of next graphics object in graphics object list. null or 0 means parameter position is the last position in graphics object list.

## ◆ GetPrevGraphicsObjectPosition()

def FoxitPDFSDKPython3.GraphicsObjects.GetPrevGraphicsObjectPosition | ( |  | position,
|  |  | filter
| ) |  |

Get the position of previous graphics object in graphics object list, based on type filter and specified current position.

After getting a position in the graphics object list, then user can call function FoxitPDFSDKPython3.GraphicsObjects.GetGraphicsObject to get the graphics object with this position.

Parameters

  [in] | position | A POSITION object that indicates a position in the graphics object list, whose previous position is to be gotten. It should not be null or 0.
  [in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FoxitPDFSDKPython3.GraphicsObject.e_TypeAll and this should be one of these values. FoxitPDFSDKPython3.GraphicsObject.e_TypeAll means for all kinds of graphics objects. Default value: FoxitPDFSDKPython3.GraphicsObject.e_TypeAll .

Returns
  A POSITION object that represents the position of previous graphics object in graphics object list. null or 0 means parameter position is already in the first position in graphics object list.

## ◆ InsertGraphicsObject()

def FoxitPDFSDKPython3.GraphicsObjects.InsertGraphicsObject | ( |  | position_insert_after,
|  |  | graphics_object
| ) |  |

Insert a graphics object after the specified position.

Parameters

  [in] | position_insert_after | Used to specify the position, in order to insert parameter graphics_object after this position. 0 means that parameter graphics_object will be inserted before all graphics objects.
  [in] | graphics_object | A graphics object to be inserted. User should ensure that parameter graphics_object belongs to the same PDF document as current graphics objects.

Returns
  The new position of the inserted graphics object.

Note
  When this function succeeds, function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent should be called. Please refer to function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent for more details.

## ◆ IsEmpty()

def FoxitPDFSDKPython3.GraphicsObjects.IsEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ MoveGraphicsObjectByPosition()

def FoxitPDFSDKPython3.GraphicsObjects.MoveGraphicsObjectByPosition | ( |  | current_position,
|  |  | position_move_after
| ) |  |

Move a graphics object from a position to another position.

Parameters

  [in] | current_position | Current position of the graphics object which is to be moved to new position.
  [in] | position_move_after | Used to specify the position, in order to move the graphics object specified by parameter current_position after this position. null means that the graphics object specified by parameter current_positionwill be moved before all graphics objects.

Returns
  New position of the moved graphics object.

Note
  When this function succeeds, function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent should be called. Please refer to function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent for more details.

## ◆ RemoveGraphicsObject()

def FoxitPDFSDKPython3.GraphicsObjects.RemoveGraphicsObject | ( |  | graphics_object | ) |

Remove a graphics object.

To remove a graphics object by position (function FoxitPDFSDKPython3.GraphicsObjects.RemoveGraphicsObjectByPosition ) is more direct and effective than to remove a graphics object directly (function FoxitPDFSDKPython3.GraphicsObjects.RemoveGraphicsObject ).

Parameters

  [in] | graphics_object | A graphics object to be removed. Please ensure this graphics object belongs to current graphics objects.

Returns
  true means success, while false means failure.

Note
  When this function succeeds, function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent should be called. Please refer to function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent for more details.

## ◆ RemoveGraphicsObjectByPosition()

def FoxitPDFSDKPython3.GraphicsObjects.RemoveGraphicsObjectByPosition | ( |  | position | ) |

Remove a graphics object by position.

To remove a graphics object by position (function FoxitPDFSDKPython3.GraphicsObjects.RemoveGraphicsObjectByPosition ) is more direct and effective than to remove a graphics object directly (function FoxitPDFSDKPython3.GraphicsObjects.RemoveGraphicsObject ).

Parameters

  [in] | position | Used to specify the position of a graphics object, to be removed. It should not be null or 0.

Returns
  true means success, while false means failure.

Note
  When this function succeeds, function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent should be called. Please refer to function FoxitPDFSDKPython3.GraphicsObjects.GenerateContent for more details.

## Member Data Documentation

## ◆ e_TextMergeBTET

FoxitPDFSDKPython3.GraphicsObjects.e_TextMergeBTET = _fsdk.GraphicsObjects_e_TextMergeBTET
| static

Merge consecutive BTETs as a new one.

'/BT' is an operator in the content stream that indicates the start of a text object. '/ET' is an operator in the content stream that indicates the end of a text object. If the merge option is used, it will merge multiple consecutive '/BT' and '/ET' as a new one.