Skip to main content

PdfStructElement

Struct PdfStructElement 

Source
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>

Source

pub fn element_type(&self) -> PdfStructElementType

Returns the parsed PdfStructElementType of this element.

Source

pub fn element_type_raw(&self) -> Option<String>

Returns the raw type string (/S entry) of this element, if any.

Source

pub fn title(&self) -> Option<String>

Returns the title (/T entry) of this element, if any.

Source

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.

Source

pub fn actual_text(&self) -> Option<String>

Returns the actual text (/ActualText entry) of this element, if any.

Source

pub fn id(&self) -> Option<String>

Returns the ID of this element, if any.

Source

pub fn lang(&self) -> Option<String>

Returns the language (IETF BCP 47 code) of this element, if any.

Source

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.

Source

pub fn marked_content_id_count(&self) -> usize

Returns the count of marked content IDs associated with this element.

Source

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.

Source

pub fn all_marked_content_ids(&self) -> Vec<i32>

Returns all marked content IDs associated with this element.

Source

pub fn parent(&self) -> Option<PdfStructElement<'a>>

Returns the parent structure element, or None if this is a root element.

Source

pub fn children_count(&self) -> usize

Returns the number of direct children of this element.

Source

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).

Source

pub fn children(&self) -> PdfStructElementChildrenIterator<'a>

Returns an iterator over the direct children of this element.

Source

pub fn attribute_count(&self) -> usize

Returns the number of attributes on this element.

Source

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>

Source§

fn clone(&self) -> PdfStructElement<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.