StructureElement

StructureElement

Overview

StructureElement is a class in Aspose.PDF FOSS for Python.

A mutable logical-structure element in a tagged PDF.

This class provides 5 methods for working with StructureElement objects in Python programs. Available methods include: __init__, add_child, move_to, remove, set_reading_order. All public members are accessible to any Python application after installing the Aspose.PDF FOSS for Python package. Properties: actual_text, alt_text, children, mcids, page_number, parent, and 1 more.

Properties

NameTypeAccessDescription
structure_typestrRead/WriteGet or set the element’s structure type, such as P or Figure.
alt_textstr | NoneRead/WriteGet or set the /Alt alternate description.
actual_textstr | NoneRead/WriteGet or set the /ActualText replacement text.
page_numberint | NoneReadReturn the one-based page number referenced by /Pg.
mcidstuple[int, ...]ReadReturn direct marked-content IDs referenced by this element.
parentStructureElement | NoneReadReturn the parent element, or None for a top-level element.
childrenlist[StructureElement]ReadReturn direct child elements in logical reading order.

Methods

SignatureDescription
__init__(content: TaggedContent, element: Any)Calls init(content, element) on this StructureElement instance.
add_child(structure_type: str, index: int | None, page_number: int | None, mcids: Iterable[int], alt_text: str | None, actual_text: str | None)StructureElementCreate a direct child element.
move_to(parent: StructureElement | None, index: int | None)Move this element to a parent and reading-order position.
set_reading_order(elements: Sequence[StructureElement])Set the complete order of this element’s direct children.
remove()Remove this element and its descendants from the structure tree.

See Also