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
Core.PDFNet.Obj a low-level (SDF/Cos) dictionary representing the . Note: This constructor does not copy any data, but is instead the logical equivalent of a type cast. Returns:
A promise that resolves to an object of type: "PDFNet.STree"- Type
- Promise.<Core.PDFNet.STree>
-
<static> createFromPDFDoc(doc)
-
Create a structure tree if it is missing, else return the existing structure tree
Parameters:
Name Type Description doc
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the document in which to create or get the structure tree from Returns:
A promise that resolves to structure tree of the document- Type
- Promise.<Core.PDFNet.STree>
-
copy()
-
Copy Constructor
Returns:
A promise that resolves to an object of type: "PDFNet.STree"- Type
- Promise.<Core.PDFNet.STree>
-
getClassMap()
-
Returns:
A promise that resolves to the ClassMap object from the structure tree root.- Type
- Promise.<Core.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
- Promise.<Core.PDFNet.SElement>
-
getNumKids()
-
Returns:
A promise that resolves to the number of kids of the structure tree root.- Type
- Promise.<number>
-
getRoleMap()
-
Returns:
A promise that resolves to the RoleMap object from the structure tree root.- Type
- Promise.<Core.PDFNet.RoleMap>
-
getSDFObj()
-
Returns:
A promise that resolves to pointer to the underlying SDF/Cos object.- Type
- Promise.<Core.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
Core.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. Returns:
- Type
- Promise.<void>
-
isValid()
-
Returns:
A promise that resolves to true if this is a valid STree object, false otherwise.- Type
- Promise.<boolean>