Class: STree

PDFNet. STree


new STree()

STree is the root of the structure tree, which is a central repository for information related to a PDF document's logical structure. There is at most one structure tree in each document.

Methods


<static> create(struct_dict)

Initialize a STree using an existing low-level Cos/SDF object.

Parameters:
Name Type Description
struct_dict PDFNet.Obj

a low-level (SDF/Cos) dictionary representing the .

Returns:

A promise that resolves to an object of type: "STree"

Type
PDFNet.STree

<static> createFromPDFDoc(doc)

Create a structure tree if it is missing, else return the existing structure tree

Parameters:
Name Type Description
doc PDFNet.PDFDoc

the document in which to create or get the structure tree from

Returns:

A promise that resolves to structure tree of the document

Type
PDFNet.STree

copy()

Copy Constructor

Returns:

A promise that resolves to an object of type: "STree"

Type
PDFNet.STree

getClassMap()

Returns:

A promise that resolves to the ClassMap object from the structure tree root.

Type
PDFNet.ClassMap

getKid(index)

Parameters:
Name Type Description
index number

The index of the kid to obtain.

Returns:

A promise that resolves to the kid at an array index in the structure tree root.

Type
PDFNet.selement

getNumKids()

Returns:

A promise that resolves to the number of kids of the structure tree root.

Type
number

getRoleMap()

Returns:

A promise that resolves to the RoleMap object from the structure tree root.

Type
PDFNet.RoleMap

getSDFObj()

Returns:

A promise that resolves to pointer to the underlying SDF/Cos object.

Type
PDFNet.Obj

insert(kid, insert_before)

Inserts the specified kid element after the given position as a kid of the specified structure tree root.

Parameters:
Name Type Description
kid PDFNet.selement

The kid element to insert.

insert_before number

The position after which the kid is inserted. If element currently has no kids, insert_before is ignored.


isValid()

Returns:

A promise that resolves to true if this is a valid STree object, false otherwise.

Type
boolean