Struct PdfPageTextSegment

Source
pub struct PdfPageTextSegment<'a> { /* private fields */ }
Expand description

A single rectangular text segment in a PdfPageTextSegments collection.

Pdfium automatically merges smaller text boxes into larger text segments if all enclosed characters share the same baseline and the same font settings. The number of individual PdfPageTextObject objects on the page may be much larger than the number of text segments.

Implementations§

Source§

impl<'a> PdfPageTextSegment<'a>

Source

pub fn bounds(&self) -> PdfRect

Returns the bounding box of this PdfPageTextSegment.

Source

pub fn width(&self) -> PdfPoints

Returns the width of this PdfPageTextSegment.

Source

pub fn height(&self) -> PdfPoints

Returns the height of this PdfPageTextSegment.

Source

pub fn is_inside_rect(&self, rect: &PdfRect) -> bool

Returns true if the bounds of this PdfPageTextSegment lie entirely within the given rectangle.

Source

pub fn does_overlap_rect(&self, rect: &PdfRect) -> bool

Returns true if the bounds of this PdfPageTextSegment lie at least partially within the given rectangle.

Source

pub fn text(&self) -> String

Returns all characters that lie within the bounds of this PdfPageTextSegment in the containing PdfPage, in the order in which they are defined in the document.

In complex custom layouts, the order in which characters are defined in the document and the order in which they appear visually during rendering (and thus the order in which they are read by a user) may not necessarily match.

Source

pub fn chars(&self) -> Result<PdfPageTextChars<'_>, PdfiumError>

Returns a collection of all the PdfPageTextChar characters that lie within the bounds of this PdfPageTextSegment in the containing PdfPage, in the order in which they are defined in the document.

In complex custom layouts, the order in which characters are defined in the document and the order in which they appear visually during rendering (and thus the order in which they are read by a user) may not necessarily match.

Auto Trait Implementations§

§

impl<'a> Freeze for PdfPageTextSegment<'a>

§

impl<'a> !RefUnwindSafe for PdfPageTextSegment<'a>

§

impl<'a> !Send for PdfPageTextSegment<'a>

§

impl<'a> !Sync for PdfPageTextSegment<'a>

§

impl<'a> Unpin for PdfPageTextSegment<'a>

§

impl<'a> !UnwindSafe for PdfPageTextSegment<'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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.