Foxit PDF SDK
FSGraphicsObjects Class Reference
Inheritance diagram for FSGraphicsObjects:
FSBase FSPDFPage

Instance Methods

(BOOL) - generateContent
 Generate contents of current graphics objects.
More...
 
(long) - getFirstGraphicsObjectPosition:
 Get the position of first graphics object in graphics object list, based on type filter.
More...
 
(FSGraphicsObject *) - getGraphicsObject:
 Get the graphics object by position in graphics object list.
More...
 
(long) - getLastGraphicsObjectPosition:
 Get the position of last graphics object in graphics object list, based on type filter.
More...
 
(long) - getNextGraphicsObjectPosition:filter:
 Get the position of next graphics object in graphics object list, based on type filter and specified current position.
More...
 
(long) - getPrevGraphicsObjectPosition:filter:
 Get the position of previous graphics object in graphics object list, based on type filter and specified current position.
More...
 
(id) - initWithOther:
 Constructor, with another FSGraphicsObjects object.
More...
 
(long) - insertGraphicsObject:graphics_object:
 Insert a graphics object after the specified position.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(BOOL) - removeGraphicsObject:
 Remove a graphics object.
More...
 
(BOOL) - removeGraphicsObjectByPosition:
 Remove a graphics object by position.
More...
 

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 FSGraphicsObjects::generateContent should be called to ensure that all these changes would be stored to PDF document. Please refer to function FSGraphicsObjects::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 FSPDFPage is derived from class FSGraphicsObjects in order that class FSPDFPage 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 FSFormXObject::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
FSPDFPage
FSFormXObject
FSGraphicsObject

Method Documentation

◆ generateContent()

- (BOOL) generateContent

Generate contents of current graphics objects.

If any graphics object is changed, or graphics object is inserted/removed, 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 takes 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 represents a PDF page, user is recommended to re-parse the PDF page function FSPDFPage::startParse:pause:is_reparse: with parameter is_reparse YES before rendering the page again; otherwise, otherwise, the page content may not be rendered as expected. Please refer to function FSPDFPage::startParse:pause:is_reparse: for more details about re-parsing a PDF page.

Returns
YES means success, while NO means failure.

◆ getFirstGraphicsObjectPosition:()

- (long) getFirstGraphicsObjectPosition: (FSGraphicsObjectType 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 FSGraphicsObjects::getGraphicsObject: to get the graphics object with this position.

Parameters
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
A POSITION object that represents the position of first graphics object in graphics object list. nil or 0 means there is no graphics object.

◆ getGraphicsObject:()

- (FSGraphicsObject *) getGraphicsObject: (long)  position

Get the graphics object by position in graphics object list.

Parameters
[in]positionA POSITION object that indicates the position in the graphics object list. It should not be nil or 0.
Returns
A FSGraphicsObject object.

◆ getLastGraphicsObjectPosition:()

- (long) getLastGraphicsObjectPosition: (FSGraphicsObjectType 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 FSGraphicsObjects::getGraphicsObject: to get the graphics object with this position.

Parameters
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
A POSITION object that represents the position of last graphics object in graphics object list. nil or 0 means there is no graphics object.

◆ getNextGraphicsObjectPosition:filter:()

- (long) getNextGraphicsObjectPosition: (long)  position
filter: (FSGraphicsObjectType 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 FSGraphicsObjects::getGraphicsObject: to get the graphics object with this position.

Parameters
[in]positionA POSITION object that indicates a position in the graphics object list, whose next position is to be gotten. It should not be nil or 0.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
A POSITION object that represents the position of next graphics object in graphics object list. nil or 0 means parameter position is the last position in graphics object list.

◆ getPrevGraphicsObjectPosition:filter:()

- (long) getPrevGraphicsObjectPosition: (long)  position
filter: (FSGraphicsObjectType 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 FSGraphicsObjects::getGraphicsObject: to get the graphics object with this position.

Parameters
[in]positionA POSITION object that indicates a position in the graphics object list, whose previous position is to be gotten. It should not be nil or 0.
[in]filterType filter that specifies which kind of graphics object is to be gotten. Please refer to values starting from FSGraphicsObjectTypeAll and this should be one of these values. FSGraphicsObjectTypeAll means for all kinds of graphics objects.
Returns
A POSITION object that represents the position of previous graphics object in graphics object list. nil or 0 means parameter position is already in the first position in graphics object list.

◆ initWithOther:()

- (id) initWithOther: (FSGraphicsObjects*)  other

Constructor, with another FSGraphicsObjects object.

Parameters
[in]otherAnother FSGraphicsObjects object.

Reimplemented in FSPDFPage.

◆ insertGraphicsObject:graphics_object:()

- (long) insertGraphicsObject: (long)  position_insert_after
graphics_object: (FSGraphicsObject*)  graphics_object 

Insert a graphics object after the specified position.

Parameters
[in]position_insert_afterUsed to specify the position, in order to insert parameter graphics_object after this position. nil means that parameter graphics_object will be inserted before all objects.
[in]graphics_objectA 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 FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ isEmpty()

- (BOOL) isEmpty

Check whether current object is empty or not.

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

Returns
YES means current object is empty, while NO means not.

◆ removeGraphicsObject:()

- (BOOL) removeGraphicsObject: (FSGraphicsObject*)  graphics_object

Remove a graphics object.

To remove a graphics object by position (function FSGraphicsObjects::removeGraphicsObjectByPosition:) is more direct and effective than to remove a graphics object directly (function FSGraphicsObjects::removeGraphicsObject:).

Parameters
[in]graphics_objectA graphics object to be removed. Please ensure this graphics object belongs to current graphics objects.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.

◆ removeGraphicsObjectByPosition:()

- (BOOL) removeGraphicsObjectByPosition: (long)  position

Remove a graphics object by position.

To remove a graphics object by position (function FSGraphicsObjects::removeGraphicsObjectByPosition:) is more direct and effective than to remove a graphics object directly (function FSGraphicsObjects::removeGraphicsObject:).

Parameters
[in]positionUsed to specify the position of a graphics object, to be removed. It should not be nil or 0.
Returns
YES means success, while NO means failure.
Note
When this function succeeds, function FSGraphicsObjects::generateContent should be called. Please refer to function FSGraphicsObjects::generateContent for more details.