Foxit PDF RDK

Public Member Functions | Static Public Attributes | List of all members
LayerTree Class Reference
Inheritance diagram for LayerTree:

## Public Member Functions
| constructor (document)
| Constructor, from a PDF document. More...
| GetDict ()
| Get the dictionary of current object. More...
| GetOCGs ()
| Get the "OCGs" PDF array from current object. More...
| GetRootNode ()
| Get the root layer node. More...
| IsEmpty ()
| Check whether current object is empty or not. More...
| SetBaseState (state)
| Set the base state for all layers in the default configuration. More...
Public Member Functions inherited from NativeObjectWrapper
| constructor (r)
| GetPointerAsNumber ()

## Static Public Attributes
static | e_StateOFF
| The state is OFF.
static | e_StateON
| Enumeration for PDF layer base state. More...
static | e_StateUnchanged
| The state is unchanged.
static | e_StateUndefined
| The state is undefined.

## Detailed Description

PDF layer nodes are stored in a PDF layer tree. If user wants to retrieve a layer node, user must construct a layer tree object from a PDF document first and then call function LayerTree.GetRootNode to get the root layer node of the whole layer tree. Then, user can enumerate all the nodes in the layer tree from the root layer node.

See also
  LayerNode

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## Member Function Documentation

## ◆ constructor()

LayerTree.constructor | ( | document |  | ) |

Constructor, from a PDF document.

The constructed layer tree object can be associated with existed layer tree in PDF document. If there is no layer tree in PDF document which can be judged by functoin PDFDoc.HasLayer, the constructed layer tree object will build layer related dictionary.

Parameters

  [in] | document | A valid PDF document object.

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## ◆ GetDict()

LayerTree.GetDict | ( |  | ) |

Get the dictionary of current object.

Note
  Please refer to "Optional Content Properties Dictionary" in <PDF Reference 1.7> P375 for more details.

Returns
  The dictionary of current object. If there is any error, this function will return null.

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## ◆ GetOCGs()

LayerTree.GetOCGs | ( |  | ) |

Get the "OCGs" PDF array from current object.

Note
  Please refer to "Optional Content Properties Dictionary" in <PDF Reference 1.7> P375 for more details.

Returns
  The "OCGs" PDF array. If there is no "OCGs" entry or any error occurs, this function will return null.

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## ◆ GetRootNode()

LayerTree.GetRootNode | ( |  | ) |

Get the root layer node.

After getting the root layer node, user can enumerate all layer nodes in current layer tree by functions of class LayerNode.

Returns
  Root layer node.

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## ◆ IsEmpty()

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

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## ◆ SetBaseState()

LayerTree.SetBaseState | ( | state |  | ) |

Set the base state for all layers in the default configuration.

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 LayerContext to Renderer to do rendering.

Parameters

  [in] | state | Layer usage state. Please refer to values starting from LayerTree.e_StateON and this should be one of these values except LayerTree.e_StateUndefined.

Returns
  true means success, while false means failure.

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.

## Member Data Documentation

## ◆ e_StateON

LayerTree.e_StateON
| static

Enumeration for PDF layer base state.

Values of this enumeration should be used alone.

The state is ON.

Examples
  /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.