Public Member Functions | |
LayerNode (LayerNode other) | |
Constructor, with another LayerNode object. More... | |
LayerNode | addChild (int index, String name, boolean has_Layer) throws com.foxit.sdk.PDFException |
Add a new layer node as a child for current layer node. More... | |
boolean | addGraphicsObject (PDFPage page, GraphicsObject graphicsobject) throws com.foxit.sdk.PDFException |
Add a graphics object to current layer node. More... | |
LayerNode | getChild (int index) throws com.foxit.sdk.PDFException |
Get a child node. More... | |
int | getChildrenCount () throws com.foxit.sdk.PDFException |
Get the count of children nodes. More... | |
int | getExportUsage () throws com.foxit.sdk.PDFException |
Get the state for exporting usage. More... | |
GraphicsObjectArray | getGraphicsObjects (PDFPage page) throws com.foxit.sdk.PDFException |
Get all graphics objects related to the layer which is associated with current layer node. More... | |
String | getName () throws com.foxit.sdk.PDFException |
Get the name of current layer node. More... | |
LayerPrintData | getPrintUsage () throws com.foxit.sdk.PDFException |
Get the data for printing usage. More... | |
int | getViewUsage () throws com.foxit.sdk.PDFException |
Get the state for viewing usage. More... | |
LayerZoomData | getZoomUsage () throws com.foxit.sdk.PDFException |
Get the data for zooming usage. More... | |
boolean | hasIntent (String intent) throws com.foxit.sdk.PDFException |
Check if current layer node has a specified intent. More... | |
boolean | hasLayer () throws com.foxit.sdk.PDFException |
Check if current layer node is associated with a layer. More... | |
boolean | isEmpty () |
Check whether current object is empty or not. More... | |
boolean | isInPage (PDFPage page) throws com.foxit.sdk.PDFException |
Check if current layer node is in a specified PDF page. More... | |
boolean | moveTo (LayerNode parent_layer_node, int index) throws com.foxit.sdk.PDFException |
Move current layer node to be one of the children of another layer node. More... | |
boolean | removeChild (int index) throws com.foxit.sdk.PDFException |
Remove a child node by index. More... | |
boolean | removeGraphicsObject (GraphicsObject graphics_object) throws com.foxit.sdk.PDFException |
Remove a graphics object from current layer node. More... | |
boolean | removeUsage (int usage_type) throws com.foxit.sdk.PDFException |
Remove a kind of usage property. More... | |
boolean | setDefaultVisible (boolean is_visible) throws com.foxit.sdk.PDFException |
Set default visibility. More... | |
boolean | setExportUsage (int state) throws com.foxit.sdk.PDFException |
Set state for exporting usage. More... | |
boolean | setName (String name) throws com.foxit.sdk.PDFException |
Set the name of current layer node. More... | |
boolean | setPrintUsage (LayerPrintData data) throws com.foxit.sdk.PDFException |
Set data for layer printing usage. More... | |
boolean | setViewUsage (int state) throws com.foxit.sdk.PDFException |
Set state for viewing usage. More... | |
boolean | setZoomUsage (LayerZoomData data) throws com.foxit.sdk.PDFException |
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 GraphicsObject 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 PDFLayerTree 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:
To get/set layer data, following functions can be used: LayerNode::getName, LayerNode::getViewUsage, LayerNode::getExportUsage, LayerNode::getPrintUsage, LayerNode::getZoomUsage and setting functions for these data.
To get the graphics belonging to it, use function LayerNode::getGraphicsObjects; function LayerNode::addGraphicsObject and LayerNode::removeGraphicsObject can be used to add/remove a specified graphics object to/from the layer.
com.foxit.sdk.pdf.LayerNode.LayerNode | ( | LayerNode | other | ) |
LayerNode com.foxit.sdk.pdf.LayerNode.addChild | ( | int | index, |
String | name, | ||
boolean | has_Layer | ||
) | throws com.foxit.sdk.PDFException |
Add a new layer node as a child for current layer node.
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. |
name | Name for the new layer node. It should not be an empty string. |
has_Layer | true means the new child layer node would be associated with a layer, and false means the new child layer node is not associated with a layer. |
boolean com.foxit.sdk.pdf.LayerNode.addGraphicsObject | ( | PDFPage | page, |
GraphicsObject | graphicsobject | ||
) | throws com.foxit.sdk.PDFException |
Add a graphics object to current layer node.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
page | A valid PDF page, to which the input graphics object belongs. |
graphicsobject | A graphics object to be added to current layer node. |
LayerNode com.foxit.sdk.pdf.LayerNode.getChild | ( | int | index | ) | throws com.foxit.sdk.PDFException |
Get a child node.
index | Index of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function LayerNode::getChildrenCount. |
int com.foxit.sdk.pdf.LayerNode.getChildrenCount | ( | ) | throws com.foxit.sdk.PDFException |
Get the count of children nodes.
int com.foxit.sdk.pdf.LayerNode.getExportUsage | ( | ) | throws com.foxit.sdk.PDFException |
Get the state for exporting usage.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
GraphicsObjectArray com.foxit.sdk.pdf.LayerNode.getGraphicsObjects | ( | PDFPage | page | ) | throws com.foxit.sdk.PDFException |
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 true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
page | A valid PDF page, to which the input graphics object belongs. |
String com.foxit.sdk.pdf.LayerNode.getName | ( | ) | throws com.foxit.sdk.PDFException |
Get the name of current layer node.
LayerPrintData com.foxit.sdk.pdf.LayerNode.getPrintUsage | ( | ) | throws com.foxit.sdk.PDFException |
Get the data for printing usage.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
int com.foxit.sdk.pdf.LayerNode.getViewUsage | ( | ) | throws com.foxit.sdk.PDFException |
Get the state for viewing usage.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
LayerZoomData com.foxit.sdk.pdf.LayerNode.getZoomUsage | ( | ) | throws com.foxit.sdk.PDFException |
Get the data for zooming usage.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
boolean com.foxit.sdk.pdf.LayerNode.hasIntent | ( | String | intent | ) | throws com.foxit.sdk.PDFException |
Check if current layer node has a specified intent.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
Specially, when this function with input parameter "View" returns false, that means the layer related to current layer node will always be visible, and will not be affected by the changing in visibility.
intent | Intent name to be checked. It should not be an empty string. Pre-defined intent names are "View" and "Design". |
boolean com.foxit.sdk.pdf.LayerNode.hasLayer | ( | ) | throws com.foxit.sdk.PDFException |
Check if current layer node is associated with a layer.
boolean com.foxit.sdk.pdf.LayerNode.isEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
boolean com.foxit.sdk.pdf.LayerNode.isInPage | ( | PDFPage | page | ) | throws com.foxit.sdk.PDFException |
Check if current layer node is in a specified PDF page.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
page | A valid PDF page. |
boolean com.foxit.sdk.pdf.LayerNode.moveTo | ( | LayerNode | parent_layer_node, |
int | index | ||
) | throws com.foxit.sdk.PDFException |
Move current layer node to be one of the children of another layer node.
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. |
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. |
boolean com.foxit.sdk.pdf.LayerNode.removeChild | ( | int | index | ) | throws com.foxit.sdk.PDFException |
Remove a child node by index.
index | Index of the child node to be removed. Valid range: from 0 to (count-1). count is returned by function LayerNode::getChildrenCount. |
boolean com.foxit.sdk.pdf.LayerNode.removeGraphicsObject | ( | GraphicsObject | graphics_object | ) | throws com.foxit.sdk.PDFException |
Remove a graphics object from current layer node.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
If the input graphics object does not belong to current layer node, this function will return true directly.
graphics_object | A graphics object to be removed from current layer node. |
boolean com.foxit.sdk.pdf.LayerNode.removeUsage | ( | int | usage_type | ) | throws com.foxit.sdk.PDFException |
Remove a kind of usage property.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
If current layer node does not have the specified usage or does not have any usage, this function will return true.
usage_type | Layer usage type to be removed. Please refer to values starting from e_UsageView and this should be one of these values. |
boolean com.foxit.sdk.pdf.LayerNode.setDefaultVisible | ( | boolean | is_visible | ) | throws com.foxit.sdk.PDFException |
Set default visibility.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
is_visible | true means visible, and false means invisible. |
boolean com.foxit.sdk.pdf.LayerNode.setExportUsage | ( | int | state | ) | throws com.foxit.sdk.PDFException |
Set state for exporting usage.
If user wants the new state to have effect on rendering result, please construct a new LayerContext object after this function succeeds, and then use the new LayerContext to Renderer to do rendering.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
state | Layer usage state. It should be one of following values: e_StateON e_StateOFF e_StateUndefined means to remove this property from current layer node |
boolean com.foxit.sdk.pdf.LayerNode.setName | ( | String | name | ) | throws com.foxit.sdk.PDFException |
Set the name of current layer node.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
name | New layer node name. It should not be an empty string. |
boolean com.foxit.sdk.pdf.LayerNode.setPrintUsage | ( | LayerPrintData | data | ) | throws com.foxit.sdk.PDFException |
Set data for layer printing usage.
If user wants the new state to have effect on rendering result, please construct a new LayerContext object after this function succeeds, and then use the new LayerContext to Renderer to do rendering.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
data | New data for layer printing usage. The value of LayerPrintData::print_state should be one of following values: e_StateON e_StateOFF e_StateUndefined means to remove this property from current layer node |
boolean com.foxit.sdk.pdf.LayerNode.setViewUsage | ( | int | state | ) | throws com.foxit.sdk.PDFException |
Set state for viewing usage.
If user wants the new state to have effect on rendering result, please construct a new LayerContext object after this function succeeds, and then use the new LayerContext to Renderer to do rendering.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
state | Layer usage state. It should be one of following values: e_StateON e_StateOFF e_StateUndefined means to remove this property from current layer node |
boolean com.foxit.sdk.pdf.LayerNode.setZoomUsage | ( | LayerZoomData | data | ) | throws com.foxit.sdk.PDFException |
Set data for layer zooming usage.
This function can only be used when function LayerNode::hasLayer returns true. If current layer node does not have layer, this function will throw exception e_ErrUnsupported.
data | New data for layer zooming usage. |