StructTreeRoot Class Documentation
class StructTreeRootNamespace:datalogics_interface
Detailed Description
Internal wrapper for the root of a PDF logical structure tree.
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
Uses types
Constructor & Destructor Documentation
StructTreeRoot
StructTreeRoot(StructTreeRoot && )Parameters
~StructTreeRoot
~StructTreeRoot()Member Function Documentation
add_child
StructElement add_child(const std::string & struct_type)Parameters
struct_type: const std::string &
Returns:
StructElementCreate and append a top-level child element with the given struct type.
as_pdf_object
PDFObject as_pdf_object()Returns:
PDFObjectNon-owning handle suitable for use in dicts/arrays as an indirect reference. The StructTreeRoot dict is always indirect.
find_element_by_id
std::optional< StructElement > find_element_by_id(const std::string & id)Parameters
id: const std::string &
Returns:
std::optional< StructElement >Element whose /ID (via the tree's /IDTree) matches id, or std::nullopt when no element with that ID exists.
get_kid
StructElement get_kid(size_t index)Parameters
index: size_t
Returns:
StructElementTop-level kid at index. Always a struct element per the PDF spec.
Exceptions
- std::out_of_range —
if
indexis not less than get_kid_count().
get_kid_count
size_t get_kid_count()Returns:
size_tNumber 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
PDFDict get_pdf_dict()Returns:
PDFDictReturns 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.
operator=
StructTreeRoot & operator=(StructTreeRoot && )