StructElement Class Documentation

classStructElement

Namespace:datalogics_interface

Detailed Description

Owns a non-owning reference to its CDocument. Exposes type (/S) access, the backing dict (for arbitrary attribute reads/writes), child creation, and marked-content reference insertion.

Threading: single-thread use. A StructElement 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 StructElement must not outlive the Document that produced it.

Constructor & Destructor Documentation

~StructElement

~StructElement()

Member Function Documentation

add_child

StructElementadd_child(const std::string &struct_type)

Parameters

struct_type: const std::string &

Returns:

StructElement

Create and append a child element with the given struct type (/S).

add_marked_content_ref

voidadd_marked_content_ref(Page &page, const Container &container)

Parameters

page: Page &

Returns:

void

Append a marked-content reference. /StructParents on the page and the parent tree are wired automatically.

as_pdf_object

PDFObjectas_pdf_object()

Returns:

PDFObject

Non-owning indirect handle for use in containers.

get_kid_as_element

StructElementget_kid_as_element(size_tindex)

Parameters

index: size_t

Returns:

StructElement

Kid at index interpreted as a child struct element.

get_kid_as_marked_content_mcid

intget_kid_as_marked_content_mcid(size_tindex)

Parameters

index: size_t

Returns:

int

MCID of the marked-content kid at index.

get_kid_as_marked_content_page

Pageget_kid_as_marked_content_page(size_tindex)

Parameters

index: size_t

Returns:

Page

Page containing the marked-content kid at index.

get_kid_count

size_tget_kid_count()

Returns:

size_t

Number of kids in this element's /K array.

get_kid_type

StructKidTypeget_kid_type(size_tindex)

Parameters

index: size_t

Returns:

StructKidType

Classify the kid at index. Caller should gate type-specific accessors on this result.

get_pdf_dict

PDFDictget_pdf_dict()

Returns:

PDFDict

Full backing dict — escape hatch for all attributes (/Alt, /ActualText, /Lang, /E, /T, /ID, /A, etc.).

get_type

std::stringget_type()

Returns:

std::string

Struct type (/S) value as a string.

parent_is_tree_root

boolparent_is_tree_root()

Returns:

bool

True when this element's immediate parent is the struct tree root.