Foxit PDF SDK

Public Member Functions | List of all members
FoxitPDFSDKPython2.LayerNode Class Reference
Inheritance diagram for FoxitPDFSDKPython2.LayerNode:

## Public Member Functions
def | LayerNode (other)
| Constructor, with another layer node object. More...
def | AddChild (index, name, has_Layer)
| Add a new layer node as a child for current layer node. More...
def | AddGraphicsObject (page, graphicsobject)
| Add a graphics object to current layer node. More...
def | GetAnnots ()
| Get an array of annotations which are related to current layer node. More...
def | GetChild (index)
| Get a child node. More...
def | GetChildrenCount ()
| Get the count of children nodes. More...
def | GetDict ()
| Get the PDF dictionary of current object. More...
def | GetExportUsage ()
| Get the state for exporting usage. More...
def | GetGraphicsObjects (page)
| Get all graphics objects related to the layer which is associated with current layer node. More...
def | GetName ()
| Get the name of current layer node. More...
def | GetPrintUsage ()
| Get the data for printing usage. More...
def | GetViewUsage ()
| Get the state for viewing usage. More...
def | GetZoomUsage ()
| Get the data for zooming usage. More...
def | HasIntent (intent)
| Check if current layer node has a specified intent. More...
def | HasLayer ()
| Check if current layer node is associated with a layer. More...
def | IsEmpty ()
| Check whether current object is empty or not. More...
def | IsInPage (page)
| Check if current layer node is in a specified PDF page. More...
def | IsLocked ()
| Check if current layer node is locked. More...
def | MoveTo (parent_layer_node, index)
| Move current layer node to be one of the children of another layer node. More...
def | RemoveChild (index)
| Remove a child node by index. More...
def | RemoveGraphicsObject (graphics_object)
| Remove a graphics object from current layer node. More...
def | RemoveUsage (usage_type)
| Remove a kind of usage property. More...
def | SetDefaultVisible (is_visible)
| Set default visibility. More...
def | SetExportUsage (state)
| Set state for exporting usage. More...
def | SetName (name)
| Set the name of current layer node. More...
def | SetPrintUsage (data)
| Set data for layer printing usage. More...
def | SetViewUsage (state)
| Set state for viewing usage. More...
def | SetZoomUsage (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 FoxitPDFSDKPython2.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 layer tree object first and then call function FoxitPDFSDKPython2.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 FoxitPDFSDKPython2.LayerNode.GetChildrenCount and FoxitPDFSDKPython2.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: FoxitPDFSDKPython2.LayerNode.GetName , FoxitPDFSDKPython2.LayerNode.GetViewUsage , FoxitPDFSDKPython2.LayerNode.GetExportUsage , FoxitPDFSDKPython2.LayerNode.GetPrintUsage , FoxitPDFSDKPython2.LayerNode.GetZoomUsage and setting functions for these data.
- To get the graphics belonging to it, use function FoxitPDFSDKPython2.LayerNode.GetGraphicsObjects ; function FoxitPDFSDKPython2.LayerNode.AddGraphicsObject and FoxitPDFSDKPython2.LayerNode.RemoveGraphicsObject can be used to add/remove a specified graphics object to/from the layer.

See also
  LayerTree

## Constructor & Destructor Documentation

## ◆ LayerNode()

def FoxitPDFSDKPython2.LayerNode.LayerNode | ( |  | other | ) |

Constructor, with another layer node object.

Parameters

  [in] | other | Another layer node object.

## Member Function Documentation

## ◆ AddChild()

def FoxitPDFSDKPython2.LayerNode.AddChild | ( |  | index,
|  |  | name,
|  |  | has_Layer
| ) |  |

Add a new layer node as a child for current layer node.

Parameters

  [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 FoxitPDFSDKPython2.LayerNode.GetChildrenCount for current layer node.
  [in] | name | Name for the new layer node. It should not be an empty string.
  [in] | 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.

Returns
  A layer node object that specifies the new child layer node.

## ◆ AddGraphicsObject()

def FoxitPDFSDKPython2.LayerNode.AddGraphicsObject | ( |  | page,
|  |  | graphicsobject
| ) |  |

Add a graphics object to current layer node.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

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

Returns
  true means success, while false means failure.

## ◆ GetAnnots()

def FoxitPDFSDKPython2.LayerNode.GetAnnots | ( |  | ) |

Get an array of annotations which are related to current layer node.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will return an empty array directly.

Returns
  An array of annotations.

## ◆ GetChild()

def FoxitPDFSDKPython2.LayerNode.GetChild | ( |  | index | ) |

Get a child node.

Parameters

  [in] | index | Index of the child to be retrieved. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.LayerNode.GetChildrenCount .

Returns
  A child layer node object.

## ◆ GetChildrenCount()

def FoxitPDFSDKPython2.LayerNode.GetChildrenCount | ( |  | ) |

Get the count of children nodes.

Returns
  The count of children nodes.

## ◆ GetDict()

def FoxitPDFSDKPython2.LayerNode.GetDict | ( |  | ) |

Get the PDF dictionary of current object.

Note
  Please refer to "Optional Content Groups" in <PDF Reference 1.7> P364 for more details.

Returns
  The PDF dictionary. If FoxitPDFSDKPython2.LayerNode.HasLayer of current layer node returns false, this function will return null.

## ◆ GetExportUsage()

def FoxitPDFSDKPython2.LayerNode.GetExportUsage | ( |  | ) |

Get the state for exporting usage.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Returns
  Layer usage state. Please refer to values starting from FoxitPDFSDKPython2.LayerTree.e_StateON and this would be one of these values except FoxitPDFSDKPython2.LayerTree.e_StateUnchanged .

## ◆ GetGraphicsObjects()

def FoxitPDFSDKPython2.LayerNode.GetGraphicsObjects | ( |  | page | ) |

Get all graphics objects related to the layer which is associated with current layer node.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | page | A valid PDF page, to which the input graphics object belongs.

Returns
  A graphics object array which contains related graphic objects.

## ◆ GetName()

def FoxitPDFSDKPython2.LayerNode.GetName | ( |  | ) |

Get the name of current layer node.

Returns
  Layer node name.

## ◆ GetPrintUsage()

def FoxitPDFSDKPython2.LayerNode.GetPrintUsage | ( |  | ) |

Get the data for printing usage.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Returns
  Data for layer printing usage.

## ◆ GetViewUsage()

def FoxitPDFSDKPython2.LayerNode.GetViewUsage | ( |  | ) |

Get the state for viewing usage.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Returns
  Layer usage state. Please refer to values starting from FoxitPDFSDKPython2.LayerTree.e_StateON and this would be one of these values except FoxitPDFSDKPython2.LayerTree.e_StateUnchanged .

## ◆ GetZoomUsage()

def FoxitPDFSDKPython2.LayerNode.GetZoomUsage | ( |  | ) |

Get the data for zooming usage.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Returns
  Data for layer zooming usage.

## ◆ HasIntent()

def FoxitPDFSDKPython2.LayerNode.HasIntent | ( |  | intent | ) |

Check if current layer node has a specified intent.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.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

  [in] | intent | Intent 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()

def FoxitPDFSDKPython2.LayerNode.HasLayer | ( |  | ) |

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()

def FoxitPDFSDKPython2.LayerNode.IsEmpty | ( |  | ) |

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()

def FoxitPDFSDKPython2.LayerNode.IsInPage | ( |  | page | ) |

Check if current layer node is in a specified PDF page.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | page | A 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.

## ◆ IsLocked()

def FoxitPDFSDKPython2.LayerNode.IsLocked | ( |  | ) |

Check if current layer node is locked.

Returns
  true means current layer node is locked, while false means current layer node is not locked.

## ◆ MoveTo()

def FoxitPDFSDKPython2.LayerNode.MoveTo | ( |  | parent_layer_node,
|  |  | index
| ) |  |

Move current layer node to be one of the children of another layer node.

Parameters

  [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 FoxitPDFSDKPython2.LayerNode.GetChildrenCount for parameter parent_layer_node.

Returns
  true means success, while false means failure.

## ◆ RemoveChild()

def FoxitPDFSDKPython2.LayerNode.RemoveChild | ( |  | index | ) |

Remove a child node by index.

Parameters

  [in] | index | Index of the child node to be removed. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.LayerNode.GetChildrenCount .

Returns
  true means success, while false means failure.

## ◆ RemoveGraphicsObject()

def FoxitPDFSDKPython2.LayerNode.RemoveGraphicsObject | ( |  | graphics_object | ) |

Remove a graphics object from current layer node.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .
If the input graphics object does not belong to current layer node, this function will return true directly.

Parameters

  [in] | graphics_object | A graphics object to be removed from current layer node.

Returns
  true means success, while false means failure.

## ◆ RemoveUsage()

def FoxitPDFSDKPython2.LayerNode.RemoveUsage | ( |  | usage_type | ) |

Remove a kind of usage property.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .
If current layer node does not have the specified usage or does not have any usage, this function will return true.

Parameters

  [in] | usage_type | Layer usage type to be removed. Please refer to values starting from FoxitPDFSDKPython2.LayerContext.e_UsageView and this should be one of these values.

Returns
  true means success, while false means failure.

## ◆ SetDefaultVisible()

def FoxitPDFSDKPython2.LayerNode.SetDefaultVisible | ( |  | is_visible | ) |

Set default visibility.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | is_visible | true means visible, and false means invisible.

Returns
  true means success, while false means failure.

## ◆ SetExportUsage()

def FoxitPDFSDKPython2.LayerNode.SetExportUsage | ( |  | 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 FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | state | Layer usage state. It should be one of following values: FoxitPDFSDKPython2.LayerTree.e_StateON FoxitPDFSDKPython2.LayerTree.e_StateOFF FoxitPDFSDKPython2.LayerTree.e_StateUndefined means to remove this property from current layer node

Returns
  true means success, while false means failure.

## ◆ SetName()

def FoxitPDFSDKPython2.LayerNode.SetName | ( |  | name | ) |

Set the name of current layer node.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | name | New layer node name. It should not be an empty string.

Returns
  true means success, while false means failure.

## ◆ SetPrintUsage()

def FoxitPDFSDKPython2.LayerNode.SetPrintUsage | ( |  | 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 FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | data | New data for layer printing usage. The value of print state of input data should be one of following values: FoxitPDFSDKPython2.LayerTree.e_StateON FoxitPDFSDKPython2.LayerTree.e_StateOFF FoxitPDFSDKPython2.LayerTree.e_StateUndefined means to remove this property from current layer node

Returns
  true means success, while false means failure.

## ◆ SetViewUsage()

def FoxitPDFSDKPython2.LayerNode.SetViewUsage | ( |  | 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 FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | state | Layer usage state. It should be one of following values: FoxitPDFSDKPython2.LayerTree.e_StateON FoxitPDFSDKPython2.LayerTree.e_StateOFF FoxitPDFSDKPython2.LayerTree.e_StateUndefined means to remove this property from current layer node

Returns
  true means success, while false means failure.

## ◆ SetZoomUsage()

def FoxitPDFSDKPython2.LayerNode.SetZoomUsage | ( |  | data | ) |

Set data for layer zooming usage.

This function can only be used when function FoxitPDFSDKPython2.LayerNode.HasLayer returns true. If current layer node does not have layer, this function will throw exception FoxitPDFSDKPython2.e_ErrUnsupported .

Parameters

  [in] | data | New data for layer zooming usage.

Returns
  true means success, while false means failure.