StructElement Class Documentation

class StructElement

Namespace:datalogics_interface

Detailed Description

Internal wrapper for a single node in the PDF logical structure tree.

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

StructElement add_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

void add_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

PDFObject as_pdf_object()

Returns:

PDFObject

Non-owning indirect handle for use in containers.

get_kid_as_element

StructElement get_kid_as_element(size_t index)

Parameters

index: size_t

Returns:

StructElement

Kid at index interpreted as a child struct element.

Exceptions

std::invalid_argument
—

if the kid is not a struct element.

get_kid_as_marked_content_mcid

int get_kid_as_marked_content_mcid(size_t index)

Parameters

index: size_t

Returns:

int

MCID of the marked-content kid at index.

Exceptions

std::invalid_argument
—

if the kid is not a marked-content ref.

get_kid_as_marked_content_page

Page get_kid_as_marked_content_page(size_t index)

Parameters

index: size_t

Returns:

Page

Page containing the marked-content kid at index.

Exceptions

std::invalid_argument
—

if the kid is not a marked-content ref.

get_kid_count

size_t get_kid_count()

Returns:

size_t

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

get_kid_type

StructKidType get_kid_type(size_t index)

Parameters

index: size_t

Returns:

StructKidType

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

get_pdf_dict

PDFDict get_pdf_dict()

Returns:

PDFDict

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

get_type

std::string get_type()

Returns:

std::string

Struct type (/S) value as a string.

parent_is_tree_root

bool parent_is_tree_root()

Returns:

bool

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