Foxit PDF SDK
|
Public Member Functions | |
GraphicsObjects (GraphicsObjects other) | |
Constructor, with another GraphicsObjects object. More... | |
synchronized void | delete () |
Clean up related resources immediately. More... | |
boolean | generateContent () throws com.foxit.sdk.PDFException |
Generate contents of current graphics objects. More... | |
boolean | generateContent (int text_merge_option) throws com.foxit.sdk.PDFException |
Generate contents of current graphics objects. More... | |
long | getFirstGraphicsObjectPosition (int filter) throws com.foxit.sdk.PDFException |
Get the position of first graphics object in graphics object list, based on type filter. More... | |
GraphicsObject | getGraphicsObject (int index) throws com.foxit.sdk.PDFException |
Get a graphics object by index. More... | |
GraphicsObject | getGraphicsObject (long position) throws com.foxit.sdk.PDFException |
Get the graphics object by position in graphics object list. More... | |
int | getGraphicsObjectCount () throws com.foxit.sdk.PDFException |
Get the count of graphics objects in graphics object list. More... | |
int | getGraphicsObjectIndex (GraphicsObject graphics_object) throws com.foxit.sdk.PDFException |
Get the index of a specified graphics object in graphics object list. More... | |
long | getGraphicsObjectPosition (GraphicsObject graphics_object) throws com.foxit.sdk.PDFException |
Get the position of the specified graphics object. More... | |
long | getLastGraphicsObjectPosition (int filter) throws com.foxit.sdk.PDFException |
Get the position of last graphics object in graphics object list, based on type filter. More... | |
long | getNextGraphicsObjectPosition (long position, int filter) throws com.foxit.sdk.PDFException |
Get the position of next graphics object in graphics object list, based on type filter and specified current position. More... | |
long | getPrevGraphicsObjectPosition (long position, int filter) throws com.foxit.sdk.PDFException |
Get the position of previous graphics object in graphics object list, based on type filter and specified current position. More... | |
long | insertGraphicsObject (long position_insert_after, GraphicsObject graphics_object) throws com.foxit.sdk.PDFException |
Insert a graphics object after the specified position. More... | |
boolean | isEmpty () |
Check whether current object is empty or not. More... | |
long | moveGraphicsObjectByPosition (long current_position, long position_move_after) throws com.foxit.sdk.PDFException |
Move a graphics object from a position to another position. More... | |
boolean | removeGraphicsObject (GraphicsObject graphics_object) throws com.foxit.sdk.PDFException |
Remove a graphics object. More... | |
boolean | removeGraphicsObjectByPosition (long position) throws com.foxit.sdk.PDFException |
Remove a graphics object by position. More... | |
Static Public Attributes | |
static final int | e_TextMergeBTET = 2 |
Merge consecutive BTETs as a new one. More... | |
static final int | e_TextMergeNone = 0 |
No text merge. | |
static final int | e_TextMergeTJY = 1 |
Merge consecutive text-showing operators with equal y coordinates. | |
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 GraphicsObjects.generateContent should be called to ensure that all these changes would be stored to PDF document. Please refer to function 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 com.foxit.sdk.pdf.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 graphics.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.
com.foxit.sdk.pdf.GraphicsObjects.GraphicsObjects | ( | GraphicsObjects | other | ) |
Constructor, with another GraphicsObjects object.
[in] | other | Another GraphicsObjects object. |
synchronized void com.foxit.sdk.pdf.GraphicsObjects.delete | ( | ) |
Clean up related resources immediately.
Reimplemented from com.foxit.sdk.common.Base.
Reimplemented in com.foxit.sdk.pdf.PDFPage.
boolean com.foxit.sdk.pdf.GraphicsObjects.generateContent | ( | ) | throws com.foxit.sdk.PDFException |
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 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 PDFPage.startParse for more details about re-parsing a PDF page.
boolean com.foxit.sdk.pdf.GraphicsObjects.generateContent | ( | int | text_merge_option | ) | throws com.foxit.sdk.PDFException |
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 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 PDFPage.startParse for more details about re-parsing a PDF page.
[in] | text_merge_option | The merge option for text object. Please refer to values starting from com.foxit.sdk.pdf.GraphicsObjects.e_TextMergeNone and this should be one of these values. |
long com.foxit.sdk.pdf.GraphicsObjects.getFirstGraphicsObjectPosition | ( | int | filter | ) | throws com.foxit.sdk.PDFException |
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 GraphicsObjects.getGraphicsObject to get the graphics object with this position.
[in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll and this should be one of these values. com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll means for all kinds of graphics objects. |
GraphicsObject com.foxit.sdk.pdf.GraphicsObjects.getGraphicsObject | ( | int | index | ) | throws com.foxit.sdk.PDFException |
Get a graphics object by index.
[in] | index | Index of a graphics object to be retrieved. Valid range: from 0 to (count-1). count is returned by function GraphicsObjects.getGraphicsObjectCount . |
GraphicsObject com.foxit.sdk.pdf.GraphicsObjects.getGraphicsObject | ( | long | position | ) | throws com.foxit.sdk.PDFException |
Get the graphics object by position in graphics object list.
[in] | position | A POSITION object that indicates the position in the graphics object list. It should not be null or 0. |
int com.foxit.sdk.pdf.GraphicsObjects.getGraphicsObjectCount | ( | ) | throws com.foxit.sdk.PDFException |
Get the count of graphics objects in graphics object list.
int com.foxit.sdk.pdf.GraphicsObjects.getGraphicsObjectIndex | ( | GraphicsObject | graphics_object | ) | throws com.foxit.sdk.PDFException |
Get the index of a specified graphics object in graphics object list.
[in] | graphics_object | A graphics object whose index is to be retrieved. Please ensure that input graphics object belongs to current graphics objects. |
long com.foxit.sdk.pdf.GraphicsObjects.getGraphicsObjectPosition | ( | GraphicsObject | graphics_object | ) | throws com.foxit.sdk.PDFException |
Get the position of the specified graphics object.
[in] | graphics_object | A graphics object whose position is to be retrieved. |
long com.foxit.sdk.pdf.GraphicsObjects.getLastGraphicsObjectPosition | ( | int | filter | ) | throws com.foxit.sdk.PDFException |
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 GraphicsObjects.getGraphicsObject to get the graphics object with this position.
[in] | filter | Type filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll and this should be one of these values. com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll means for all kinds of graphics objects. |
long com.foxit.sdk.pdf.GraphicsObjects.getNextGraphicsObjectPosition | ( | long | position, |
int | filter | ||
) | throws com.foxit.sdk.PDFException |
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 GraphicsObjects.getGraphicsObject to get the graphics object with this position.
[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 com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll and this should be one of these values. com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll means for all kinds of graphics objects. |
long com.foxit.sdk.pdf.GraphicsObjects.getPrevGraphicsObjectPosition | ( | long | position, |
int | filter | ||
) | throws com.foxit.sdk.PDFException |
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 GraphicsObjects.getGraphicsObject to get the graphics object with this position.
[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 com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll and this should be one of these values. com.foxit.sdk.pdf.graphics.GraphicsObject.e_TypeAll means for all kinds of graphics objects. |
long com.foxit.sdk.pdf.GraphicsObjects.insertGraphicsObject | ( | long | position_insert_after, |
GraphicsObject | graphics_object | ||
) | throws com.foxit.sdk.PDFException |
Insert a graphics object after the specified position.
[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. |
boolean com.foxit.sdk.pdf.GraphicsObjects.isEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
long com.foxit.sdk.pdf.GraphicsObjects.moveGraphicsObjectByPosition | ( | long | current_position, |
long | position_move_after | ||
) | throws com.foxit.sdk.PDFException |
Move a graphics object from a position to another position.
[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. 0 means that the graphics object specified by parameter current_positionwill be moved before all graphics objects. |
boolean com.foxit.sdk.pdf.GraphicsObjects.removeGraphicsObject | ( | GraphicsObject | graphics_object | ) | throws com.foxit.sdk.PDFException |
Remove a graphics object.
To remove a graphics object by position (function GraphicsObjects.removeGraphicsObjectByPosition ) is more direct and effective than to remove a graphics object directly (function GraphicsObjects.removeGraphicsObject ).
[in] | graphics_object | A graphics object to be removed. Please ensure this graphics object belongs to current graphics objects. |
boolean com.foxit.sdk.pdf.GraphicsObjects.removeGraphicsObjectByPosition | ( | long | position | ) | throws com.foxit.sdk.PDFException |
Remove a graphics object by position.
To remove a graphics object by position (function GraphicsObjects.removeGraphicsObjectByPosition ) is more direct and effective than to remove a graphics object directly (function GraphicsObjects.removeGraphicsObject ).
[in] | position | Used to specify the position of a graphics object, to be removed. It should not be null or 0. |
|
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.