Foxit PDF SDK
com.foxit.sdk.pdf.LayerTree Class Reference
Inheritance diagram for com.foxit.sdk.pdf.LayerTree:
com.foxit.sdk.common.Base

Public Member Functions

 LayerTree (PDFDoc document) throws com.foxit.sdk.PDFException
 Constructor, from a PDF document. More...
 
 LayerTree (LayerTree other)
 Constructor, with another layer tree object. More...
 
synchronized void delete ()
 Clean up related resources immediately. More...
 
PDFDictionary getDict () throws com.foxit.sdk.PDFException
 Get the dictionary of current object. More...
 
PDFArray getOCGs () throws com.foxit.sdk.PDFException
 Get the "OCGs" PDF array from current object. More...
 
LayerNode getRootNode () throws com.foxit.sdk.PDFException
 Get the root layer node. More...
 
boolean isEmpty ()
 Check whether current object is empty or not. More...
 
boolean setBaseState (int state) throws com.foxit.sdk.PDFException
 Set the base state for all layers in the default configuration. More...
 
- Public Member Functions inherited from com.foxit.sdk.common.Base
synchronized void delete ()
 Clean up related resources immediately. More...
 

Static Public Attributes

static final int e_StateOFF = 0x0001
 The state is OFF.
 
static final int e_StateON = 0x0000
 The state is ON.
 
static final int e_StateUnchanged = 0x0002
 The state is unchanged.
 
static final int e_StateUndefined = 0x0003
 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

Constructor & Destructor Documentation

◆ LayerTree() [1/2]

com.foxit.sdk.pdf.LayerTree.LayerTree ( PDFDoc  document) throws com.foxit.sdk.PDFException

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]documentA valid PDF document object.

◆ LayerTree() [2/2]

com.foxit.sdk.pdf.LayerTree.LayerTree ( LayerTree  other)

Constructor, with another layer tree object.

Parameters
[in]otherAnother layer tree object.

Member Function Documentation

◆ delete()

synchronized void com.foxit.sdk.pdf.LayerTree.delete ( )

Clean up related resources immediately.

Returns
None.
Note
Once this function is called, current object cannot be used anymore.

◆ getDict()

PDFDictionary com.foxit.sdk.pdf.LayerTree.getDict ( ) throws com.foxit.sdk.PDFException

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.

◆ getOCGs()

PDFArray com.foxit.sdk.pdf.LayerTree.getOCGs ( ) throws com.foxit.sdk.PDFException

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.

◆ getRootNode()

LayerNode com.foxit.sdk.pdf.LayerTree.getRootNode ( ) throws com.foxit.sdk.PDFException

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.

◆ isEmpty()

boolean com.foxit.sdk.pdf.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.

◆ setBaseState()

boolean com.foxit.sdk.pdf.LayerTree.setBaseState ( int  state) throws com.foxit.sdk.PDFException

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]stateLayer usage state. Please refer to values starting from com.foxit.sdk.pdf.LayerTree.e_StateON and this should be one of these values except com.foxit.sdk.pdf.LayerTree.e_StateUndefined .
Returns
true means success, while false means failure.