foxit.pdf.LayerNode Class Reference
Inheritance diagram for foxit.pdf.LayerNode:
foxit.common.Base

Public Member Functions

 LayerNode (LayerNode other)
 Constructor, with another LayerNode object.

 
LayerNode AddChild (int index, string name, bool has_Layer)
 Move current layer node to be child of another layer node.
More...
 
bool AddGraphicsObject (PDFPage page, GraphicsObject graphicsobject)
 Add a graphics object to current layer node.
More...
 
LayerNode GetChild (int index)
 Get a child node.
More...
 
int GetChildrenCount ()
 Get the count of children nodes.
More...
 
LayerTree.UsageState GetExportUsage ()
 Get the state for exporting usage.
More...
 
GraphicsObjectArray GetGraphicsObjects (PDFPage page)
 Get all graphics objects related to the layer which is associated with current layer node.
More...
 
string GetName ()
 Get the name of current layer node.
More...
 
LayerPrintData GetPrintUsage ()
 Get the data for printing usage.
More...
 
LayerTree.UsageState GetViewUsage ()
 Get the state for viewing usage.
More...
 
LayerZoomData GetZoomUsage ()
 Get the data for zooming usage.
More...
 
bool HasIntent (string intent)
 Check if current layer node has a specified intent.
More...
 
bool HasLayer ()
 Check if current layer node is associated with a layer.
More...
 
bool IsEmpty ()
 Check whether current object is empty or not.
More...
 
bool IsInPage (PDFPage page)
 Check if current layer node is in a specified PDF page.
More...
 
bool MoveTo (LayerNode parent_layer_node, int index)
 Move current layer node to be child of another layer node.
More...
 
bool RemoveChild (int index)
 Remove a child node.
More...
 
bool RemoveGraphicsObject (GraphicsObject graphics_object)
 Remove a graphics object from current layer node.
More...
 
bool RemoveUsage (LayerContext.UsageType usage_type)
 Remove a kind of usage property.
More...
 
bool SetDefaultVisible (bool is_visible)
 Set default visibility.
More...
 
bool SetExportUsage (LayerTree.UsageState state)
 Set state for exporting usage.
More...
 
bool SetName (string name)
 Set the name of current layer node.
More...
 
bool SetPrintUsage (LayerPrintData data)
 Set data for layer printing usage.
More...
 
bool SetViewUsage (LayerTree.UsageState state)
 Set state for viewing usage.
More...
 
bool SetZoomUsage (LayerZoomData data)
 Set data for layer zooming usage.
More...
 

Detailed Description

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.

See also
LayerTree

Member Function Documentation

◆ AddChild()

LayerNode foxit.pdf.LayerNode.AddChild ( int  index,
string  name,
bool  has_Layer 
)
inline

Move current layer node to be child of another layer node.

Parameters
indexIndex of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function LayerNode::GetChildrenCount.
nameNew layer node name. It should not be null or an empty string.
has_LayerWhether current layer node is associated or not with a layer.
Returns
A child layer node object.

◆ AddGraphicsObject()

bool foxit.pdf.LayerNode.AddGraphicsObject ( PDFPage  page,
GraphicsObject  graphicsobject 
)
inline

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.

Parameters
pageA valid PDF page, to which the input graphics object belongs.
graphicsobjectA graphics object to be added to current layer node.
Returns
true means success, while false means failure.

◆ GetChild()

LayerNode foxit.pdf.LayerNode.GetChild ( int  index)
inline

Get a child node.

Parameters
indexIndex of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function LayerNode::GetChildrenCount.
Returns
A child LayerNode object.

◆ GetChildrenCount()

int foxit.pdf.LayerNode.GetChildrenCount ( )
inline

Get the count of children nodes.

Returns
The count of children nodes.

◆ GetExportUsage()

LayerTree.UsageState foxit.pdf.LayerNode.GetExportUsage ( )
inline

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.

Returns
Layer usage state. Please refer to e_StateXXX values and it would be one of these values except {}.

◆ GetGraphicsObjects()

GraphicsObjectArray foxit.pdf.LayerNode.GetGraphicsObjects ( PDFPage  page)
inline

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.

Parameters
pageA valid PDF page, to which the input graphics object belongs.
Returns
A graphics object array which contains related graphic objects.

◆ GetName()

string foxit.pdf.LayerNode.GetName ( )
inline

Get the name of current layer node.

Returns
Layer node name.

◆ GetPrintUsage()

LayerPrintData foxit.pdf.LayerNode.GetPrintUsage ( )
inline

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.

Returns
Data for layer printing usage.

◆ GetViewUsage()

LayerTree.UsageState foxit.pdf.LayerNode.GetViewUsage ( )
inline

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.

Returns
Layer usage state. Please refer to e_StateXXX values and it would be one of these values except {}.

◆ GetZoomUsage()

LayerZoomData foxit.pdf.LayerNode.GetZoomUsage ( )
inline

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.

Returns
Data for layer zooming usage.

◆ HasIntent()

bool foxit.pdf.LayerNode.HasIntent ( string  intent)
inline

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.

Parameters
intentIntent name to be checked. It should not be an empty string. Pre-defined intent names are "View" and "Design".
Returns
true means current layer node has the specified intent, while false means current layer node does not the specified intent.

◆ HasLayer()

bool foxit.pdf.LayerNode.HasLayer ( )
inline

Check if current layer node is associated with a layer.

Returns
true means current layer node is associated with a layer, while false means current layer node is not associated with a layer.

◆ IsEmpty()

bool foxit.pdf.LayerNode.IsEmpty ( )
inline

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.

◆ IsInPage()

bool foxit.pdf.LayerNode.IsInPage ( PDFPage  page)
inline

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.

Parameters
pageA valid PDF page.
Returns
true means current layer node is in the specified PDF page, while false means current layer node is not in the specified PDF page.

◆ MoveTo()

bool foxit.pdf.LayerNode.MoveTo ( LayerNode  parent_layer_node,
int  index 
)
inline

Move current layer node to be child of another layer node.

Parameters
parent_layer_nodeThe 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 child of the destination layer node.
indexIndex of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function LayerNode::GetChildrenCount.
Returns
true means success, while false means failure.

◆ RemoveChild()

bool foxit.pdf.LayerNode.RemoveChild ( int  index)
inline

Remove a child node.

Parameters
indexIndex of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function LayerNode::GetChildrenCount.
Returns
true means success, while false means failure.

◆ RemoveGraphicsObject()

bool foxit.pdf.LayerNode.RemoveGraphicsObject ( GraphicsObject  graphics_object)
inline

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.

Parameters
graphics_objectA graphics object to be removed from current layer node.
Returns
true means success, while false means failure.

◆ RemoveUsage()

bool foxit.pdf.LayerNode.RemoveUsage ( LayerContext.UsageType  usage_type)
inline

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.

Parameters
usage_typeLayer usage type to be removed. Please refer to e_UsageXXX values and it should be one of these values.
Returns
true means success, while false means failure.

◆ SetDefaultVisible()

bool foxit.pdf.LayerNode.SetDefaultVisible ( bool  is_visible)
inline

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.

Parameters
is_visibletrue means visible, and false means invisible.
Returns
true means success, while false means failure.

◆ SetExportUsage()

bool foxit.pdf.LayerNode.SetExportUsage ( LayerTree.UsageState  state)
inline

Set 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.

Parameters
stateLayer usage state. It should be one of following values:

e_StateON
e_StateOFF
e_StateUndefined means to remove this property from current layer node

Returns
true means success, while false means failure.

◆ SetName()

bool foxit.pdf.LayerNode.SetName ( string  name)
inline

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.

Parameters
nameNew layer node name. It should not be an empty string.
Returns
true means success, while false means failure.

◆ SetPrintUsage()

bool foxit.pdf.LayerNode.SetPrintUsage ( LayerPrintData  data)
inline

Set data for layer 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.

Parameters
dataNew 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

Returns
true means success, while false means failure.

◆ SetViewUsage()

bool foxit.pdf.LayerNode.SetViewUsage ( LayerTree.UsageState  state)
inline

Set 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.

Parameters
stateLayer usage state. It should be one of following values:

e_StateON
e_StateOFF
e_StateUndefined means to remove this property from current layer node

Returns
true means success, while false means failure.

◆ SetZoomUsage()

bool foxit.pdf.LayerNode.SetZoomUsage ( LayerZoomData  data)
inline

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.

Parameters
dataNew data for layer zooming usage.
Returns
true means success, while false means failure.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.