pub struct PdfStructElement<'a> { /* private fields */ }Expand description
A single element in the structure tree of a tagged PDF page.
Structure elements carry semantic information such as element type (paragraph, heading, table cell, etc.), alternative text, actual text, language, and marked content identifiers that associate the element with content on the page.
The element handle is not owned by this struct; it is owned by the parent
FPDF_STRUCTTREE and remains valid for as long as that tree is open.
Implementations§
Source§impl<'a> PdfStructElement<'a>
impl<'a> PdfStructElement<'a>
Sourcepub fn element_type(&self) -> PdfStructElementType
pub fn element_type(&self) -> PdfStructElementType
Returns the parsed PdfStructElementType of this element.
Sourcepub fn element_type_raw(&self) -> Option<String>
pub fn element_type_raw(&self) -> Option<String>
Returns the raw type string (/S entry) of this element, if any.
Sourcepub fn alt_text(&self) -> Option<String>
pub fn alt_text(&self) -> Option<String>
Returns the alternative text (/Alt entry) of this element, if any. This is typically used for accessibility purposes.
Sourcepub fn actual_text(&self) -> Option<String>
pub fn actual_text(&self) -> Option<String>
Returns the actual text (/ActualText entry) of this element, if any.
Sourcepub fn lang(&self) -> Option<String>
pub fn lang(&self) -> Option<String>
Returns the language (IETF BCP 47 code) of this element, if any.
Sourcepub fn marked_content_id(&self) -> Option<i32>
pub fn marked_content_id(&self) -> Option<i32>
Returns the primary marked content ID of this element, or None if no ID exists.
Consider using PdfStructElement::all_marked_content_ids to retrieve all MCIDs, as an element may have more than one.
Sourcepub fn marked_content_id_count(&self) -> usize
pub fn marked_content_id_count(&self) -> usize
Returns the count of marked content IDs associated with this element.
Sourcepub fn marked_content_id_at_index(&self, index: usize) -> Option<i32>
pub fn marked_content_id_at_index(&self, index: usize) -> Option<i32>
Returns the marked content ID at the given index, or None if the index is
out of bounds or no ID exists at that index.
Sourcepub fn all_marked_content_ids(&self) -> Vec<i32>
pub fn all_marked_content_ids(&self) -> Vec<i32>
Returns all marked content IDs associated with this element.
Sourcepub fn parent(&self) -> Option<PdfStructElement<'a>>
pub fn parent(&self) -> Option<PdfStructElement<'a>>
Returns the parent structure element, or None if this is a root element.
Sourcepub fn children_count(&self) -> usize
pub fn children_count(&self) -> usize
Returns the number of direct children of this element.
Sourcepub fn child_at_index(&self, index: usize) -> Option<PdfStructElement<'a>>
pub fn child_at_index(&self, index: usize) -> Option<PdfStructElement<'a>>
Returns the child element at the given index, or None if the index is out of
bounds or the child at that index is not a structure element (e.g. it is a
marked-content reference).
Sourcepub fn children(&self) -> PdfStructElementChildrenIterator<'a> ⓘ
pub fn children(&self) -> PdfStructElementChildrenIterator<'a> ⓘ
Returns an iterator over the direct children of this element.
Sourcepub fn attribute_count(&self) -> usize
pub fn attribute_count(&self) -> usize
Returns the number of attributes on this element.
Sourcepub fn string_attribute(&self, name: &str) -> Option<String>
pub fn string_attribute(&self, name: &str) -> Option<String>
Returns the value of a string attribute with the given name, if any.
Trait Implementations§
Source§impl<'a> Clone for PdfStructElement<'a>
impl<'a> Clone for PdfStructElement<'a>
Source§fn clone(&self) -> PdfStructElement<'a>
fn clone(&self) -> PdfStructElement<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for PdfStructElement<'a>
impl<'a> !Send for PdfStructElement<'a>
impl<'a> !Sync for PdfStructElement<'a>
impl<'a> !UnwindSafe for PdfStructElement<'a>
impl<'a> Freeze for PdfStructElement<'a>
impl<'a> Unpin for PdfStructElement<'a>
impl<'a> UnsafeUnpin for PdfStructElement<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more