PTSTree

@interface PTSTree : NSObject

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.

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

    Note

    This constructor does not copy any data, but is instead the logical equivalent of a type cast.

    Declaration

    Objective-C

    - (instancetype)initWithStruct_dict:(PTObj *)struct_dict;

    Swift

    init!(struct_dict: PTObj!)

    Parameters

    struct_dict

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

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

    Declaration

    Objective-C

    + (PTSTree *)Create:(PTPDFDoc *)doc;

    Swift

    class func create(_ doc: PTPDFDoc!) -> PTSTree!

    Parameters

    doc

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

    Return Value

    structure tree of the document

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

    Declaration

    Objective-C

    - (void)Insert:(PTSElement *)kid insert_before:(int)insert_before;

    Swift

    func insert(_ kid: PTSElement!, insert_before: Int32)

    Parameters

    kid

    The kid element to insert.

    insert_before

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

  • Declaration

    Objective-C

    - (BOOL)IsValid;

    Swift

    func isValid() -> Bool

    Return Value

    true if this is a valid STree object, false otherwise.

  • Declaration

    Objective-C

    - (int)GetNumKids;

    Swift

    func getNumKids() -> Int32

    Return Value

    The number of kids of the structure tree root.

  • Declaration

    Objective-C

    - (PTSElement *)GetKid:(int)index;

    Swift

    func getKid(_ index: Int32) -> PTSElement!

    Parameters

    index

    The index of the kid to obtain.

    Return Value

    The kid at an array index in the structure tree root.

  • Declaration

    Objective-C

    - (PTSElement *)GetElement:(NSString *)id_buf id_buf_sz:(int)id_buf_sz;

    Swift

    func getElement(_ id_buf: String!, id_buf_sz: Int32) -> PTSElement!

    Parameters

    id_buf

    A pointer to a buffer containing the ID to search for.

    id_buf_sz

    The number of characters in id_buf.

    Return Value

    the element associated with the given ID.

  • Declaration

    Objective-C

    - (PTRoleMap *)GetRoleMap;

    Swift

    func getRoleMap() -> PTRoleMap!

    Return Value

    the RoleMap object from the structure tree root.

  • Declaration

    Objective-C

    - (PTClassMap *)GetClassMap;

    Swift

    func getClassMap() -> PTClassMap!

    Return Value

    the ClassMap object from the structure tree root.

  • Declaration

    Objective-C

    - (PTObj *)GetSDFObj;

    Swift

    func getSDFObj() -> PTObj!

    Return Value

    Pointer to the underlying SDF/Cos object.