Foxit PDF SDK
|
Instance Methods | |
(FSLayerNode *) | - addChild:name:has_Layer: |
Add a new layer node as a child for current layer node. More... | |
(BOOL) | - addGraphicsObject:graphicsobject: |
Add a graphics object to current layer node. More... | |
(FSLayerNode *) | - getChild: |
Get a child node. More... | |
(int) | - getChildrenCount |
Get the count of children nodes. More... | |
(FSPDFDictionary *) | - getDict |
Get the PDF dictionary of current object. More... | |
(FSLayerTreeUsageState) | - getExportUsage |
Get the state for exporting usage. More... | |
(FSGraphicsObjectArray *) | - getGraphicsObjects: |
Get all graphics objects related to the layer which is associated with current layer node. More... | |
(NSString *) | - getName |
Get the name of current layer node. More... | |
(FSLayerPrintData *) | - getPrintUsage |
Get the data for printing usage. More... | |
(FSLayerTreeUsageState) | - getViewUsage |
Get the state for viewing usage. More... | |
(FSLayerZoomData *) | - getZoomUsage |
Get the data for zooming usage. More... | |
(BOOL) | - hasIntent: |
Check if current layer node has a specified intent. More... | |
(BOOL) | - hasLayer |
Check if current layer node is associated with a layer. More... | |
(id) | - initWithOther: |
Constructor, with another layer node object. More... | |
(BOOL) | - isEmpty |
Check whether current object is empty or not. More... | |
(BOOL) | - isInPage: |
Check if current layer node is in a specified PDF page. More... | |
(BOOL) | - isLocked |
Check if current layer node is locked. More... | |
(BOOL) | - moveTo:index: |
Move current layer node to be one of the children of another layer node. More... | |
(BOOL) | - removeChild: |
Remove a child node by index. More... | |
(BOOL) | - removeGraphicsObject: |
Remove a graphics object from current layer node. More... | |
(BOOL) | - removeUsage: |
Remove a kind of usage property. More... | |
(BOOL) | - setDefaultVisible: |
Set default visibility. More... | |
(BOOL) | - setExportUsage: |
Set state for exporting usage. More... | |
(BOOL) | - setName: |
Set the name of current layer node. More... | |
(BOOL) | - setPrintUsage: |
Set data for layer printing usage. More... | |
(BOOL) | - setViewUsage: |
Set state for viewing usage. More... | |
(BOOL) | - setZoomUsage: |
Set data for layer zooming usage. More... | |
A PDF layer (known as "Optional content group" in <PDF reference 1.7>) is a collection of graphics (known as FSGraphicsObject in Foxit PDF SDK) that can be made visible or invisible. These graphics belonging to the same layer can reside anywhere in the document: they need not be consecutive in drawing order, nor even belong to the same content stream.
In Foxit PDF SDK, a PDF layer is associated with a layer node and Foxit PDF SDK offers class and methods to get/set layer data via layer node. If user wants to retrieve a layer node, user must construct a layer tree object first and then call function LayerTree::getRootNode to get the root layer node of the whole layer tree. Here, "root layer node" is an abstract object. "root layer node" can only have some child layer nodes but no parent, or any data (such as name, intent and so on). And "root layer node" cannot be shown on the application UI since it has no data. So, for a root layer node, only functions LayerNode::getChildrenCount and LayerNode::getChild: are useful.
This class offers functions to get/set layer data and the graphics belonging to it. For example:
- (FSLayerNode *) addChild: | (int) | index | |
name: | (NSString *) | name | |
has_Layer: | (BOOL) | has_Layer | |
Add a new layer node as a child for current layer node.
[in] | index | Child index for the new child layer node. Valid range: from 0 to count. count means to be the last child of current layer node and is returned by function LayerNode::getChildrenCount for current layer node. |
[in] | name | Name for the new layer node. It should not be an empty string. |
[in] | has_Layer | YES means the new child layer node would be associated with a layer, and NO means the new child layer node is not associated with a layer. |
- (BOOL) addGraphicsObject: | (FSPDFPage*) | page | |
graphicsobject: | (FSGraphicsObject*) | graphicsobject | |
Add a graphics object to current layer node.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | page | A valid PDF page, to which the input graphics object belongs. |
[in] | graphicsobject | A graphics object to be added to current layer node. |
- (FSLayerNode *) getChild: | (int) | index |
Get a child node.
[in] | index | Index of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function LayerNode::getChildrenCount. |
- (int) getChildrenCount |
Get the count of children nodes.
- (FSPDFDictionary *) getDict |
Get the PDF dictionary of current object.
- (FSLayerTreeUsageState) getExportUsage |
Get the state for exporting usage.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
- (FSGraphicsObjectArray *) getGraphicsObjects: | (FSPDFPage*) | page |
Get all graphics objects related to the layer which is associated with current layer node.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | page | A valid PDF page, to which the input graphics object belongs. |
- (NSString *) getName |
Get the name of current layer node.
- (FSLayerPrintData *) getPrintUsage |
Get the data for printing usage.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
- (FSLayerTreeUsageState) getViewUsage |
Get the state for viewing usage.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
- (FSLayerZoomData *) getZoomUsage |
Get the data for zooming usage.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
- (BOOL) hasIntent: | (NSString *) | intent |
Check if current layer node has a specified intent.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
Specially, when this function with input parameter "View" returns NO, that means the layer related to current layer node will always be visible, and will not be affected by the changing in visibility.
[in] | intent | Intent name to be checked. It should not be an empty string. Pre-defined intent names are "View" and "Design". |
- (BOOL) hasLayer |
Check if current layer node is associated with a layer.
- (id) initWithOther: | (FSLayerNode*) | other |
Constructor, with another layer node object.
[in] | other | Another layer node object. |
- (BOOL) isEmpty |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
- (BOOL) isInPage: | (FSPDFPage*) | page |
Check if current layer node is in a specified PDF page.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | page | A valid PDF page. |
- (BOOL) isLocked |
Check if current layer node is locked.
- (BOOL) moveTo: | (FSLayerNode*) | parent_layer_node | |
index: | (int) | index | |
Move current layer node to be one of the children of another layer node.
[in] | parent_layer_node | The destination layer node. It should not be current layer node itself or any descendant of current layer node. Current layer node will be moved to be one of the children of the destination layer node. |
[in] | index | Child index which specifies where current layer node will be moved as a child of destination layer node. Valid range: from 0 to count. count means to be the last child of destination layer node and is returned by function LayerNode::getChildrenCount for parameter parent_layer_node. |
- (BOOL) removeChild: | (int) | index |
Remove a child node by index.
[in] | index | Index of the child node to be removed. Valid range: from 0 to (count-1). count is returned by function LayerNode::getChildrenCount. |
- (BOOL) removeGraphicsObject: | (FSGraphicsObject*) | graphics_object |
Remove a graphics object from current layer node.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
If the input graphics object does not belong to current layer node, this function will return YES directly.
[in] | graphics_object | A graphics object to be removed from current layer node. |
- (BOOL) removeUsage: | (FSLayerContextUsageType) | usage_type |
Remove a kind of usage property.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
If current layer node does not have the specified usage or does not have any usage, this function will return YES.
[in] | usage_type | Layer usage type to be removed. Please refer to values starting from FSLayerContextUsageView and this should be one of these values. |
- (BOOL) setDefaultVisible: | (BOOL) | is_visible |
Set default visibility.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | is_visible | YES means visible, and NO means invisible. |
- (BOOL) setExportUsage: | (FSLayerTreeUsageState) | state |
Set state for exporting usage.
If user wants the new state to have effect on rendering result, please construct a new layer context object after this function succeeds, and then use the new layer context object to Renderer to do rendering.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | state | Layer usage state. It should be one of following values:
|
- (BOOL) setName: | (NSString *) | name |
Set the name of current layer node.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | name | New layer node name. It should not be an empty string. |
- (BOOL) setPrintUsage: | (FSLayerPrintData*) | data |
Set data for layer printing usage.
If user wants the new state to have effect on rendering result, please construct a new layer context object after this function succeeds, and then use the new layer context object to Renderer to do rendering.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | data | New data for layer printing usage. The value of print state of input data should be one of following values:
|
- (BOOL) setViewUsage: | (FSLayerTreeUsageState) | state |
Set state for viewing usage.
If user wants the new state to have effect on rendering result, please construct a new layer context object after this function succeeds, and then use the new layer context object to Renderer to do rendering.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | state | Layer usage state. It should be one of following values:
|
- (BOOL) setZoomUsage: | (FSLayerZoomData*) | data |
Set data for layer zooming usage.
This function can only be used when function LayerNode::hasLayer returns YES. If current layer node does not have layer, this function will throw exception FSErrUnsupported.
[in] | data | New data for layer zooming usage. |