StructTreeRoot Class Documentation

classStructTreeRoot

Namespace:datalogics_interface

Detailed Description

Owns a non-owning reference to its CDocument. The underlying PDF structure tree is owned by the document; this wrapper provides C++ access to catalog- level struct tree operations (add children, access the backing dict).

Root of the PDF logical structure tree. Obtained exclusively via Document::create_struct_tree_root() or Document::get_struct_tree_root().

Threading: single-thread use. A StructTreeRoot is bound to its owning Document's thread; do not share it across threads. See datalogics_interface.hpp for the full threading model.

Lifetime: a StructTreeRoot must not outlive the Document that produced it.

Referenced by

Constructor & Destructor Documentation

~StructTreeRoot

~StructTreeRoot()

Member Function Documentation

add_child

StructElementadd_child(const std::string &struct_type)

Parameters

struct_type: const std::string &

Returns:

StructElement

Create and append a top-level child element with the given struct type.

as_pdf_object

PDFObjectas_pdf_object()

Returns:

PDFObject

Non-owning handle suitable for use in dicts/arrays as an indirect reference. The StructTreeRoot dict is always indirect.

get_kid

StructElementget_kid(size_tindex)

Parameters

index: size_t

Returns:

StructElement

Top-level kid at index. Always a struct element per the PDF spec.

get_kid_count

size_tget_kid_count()

Returns:

size_t

Number of top-level kids on this tree root. Per the PDF spec, all kids of a tree root are struct elements (no MCRs / OBJRs), so the counterpart accessor is get_kid(index).

get_pdf_dict

PDFDictget_pdf_dict()

Returns:

PDFDict

Returns the raw catalog-side dict for this StructTreeRoot — used as the escape hatch for /RoleMap, /IDTree, /ParentTreeNextKey and any other entry without a dedicated accessor.