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

The collection of Unicode characters visible in a single PdfPage.

Use the PdfPageText::all() function to easily return all characters in the containing PdfPage in the order in which they are defined in the PDF file.

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.

PdfPageText implements both the ToString and the Display traits.

Implementations§

source§

impl<'a> PdfPageText<'a>

source

pub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings

Returns the PdfiumLibraryBindings used by this PdfPageText.

source

pub fn len(&self) -> i32

Returns the total number of characters in all text segments in the containing PdfPage.

The character count includes whitespace and newlines, and so may differ slightly from the result of calling PdfPageText::all().len().

source

pub fn is_empty(&self) -> bool

Returns true if there are no characters in any text box collection in the containing PdfPage.

source

pub fn segments(&self) -> PdfPageTextSegments<'_>

Returns a collection of all the PdfPageTextSegment text segments in the containing PdfPage.

source

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

Returns a collection of all the PdfPageTextChar characters in the containing PdfPage.

source

pub fn chars_for_object( &self, object: &PdfPageTextObject<'_> ) -> Result<PdfPageTextChars<'_>, PdfiumError>

Returns a collection of all the PdfPageTextChar characters in the given PdfPageTextObject.

The return result will be empty if the given PdfPageTextObject is not attached to the containing PdfPage.

source

pub fn chars_for_annotation( &self, annotation: &PdfPageAnnotation<'_> ) -> Result<PdfPageTextChars<'_>, PdfiumError>

Returns a collection of all the PdfPageTextChar characters in the given PdfPageAnnotation.

The return result will be empty if the given PdfPageAnnotation is not attached to the containing PdfPage.

source

pub fn chars_inside_rect( &self, rect: PdfRect ) -> Result<PdfPageTextChars<'_>, PdfiumError>

Returns a collection of all the PdfPageTextChar characters that lie within the bounds of the given PdfRect in the containing PdfPage.

source

pub fn all(&self) -> String

Returns all characters that lie within the containing PdfPage, in the order in which they are defined in the document, concatenated into a single string.

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 inside_rect(&self, rect: PdfRect) -> String

Returns all characters that lie within the bounds of the given PdfRect in the containing PdfPage, in the order in which they are defined in the document, concatenated into a single string.

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 for_object(&self, object: &PdfPageTextObject<'_>) -> String

Returns all characters assigned to the given PdfPageTextObject in this PdfPageText object, concatenated into a single string.

source

pub fn for_annotation( &self, annotation: &PdfPageAnnotation<'_> ) -> Result<String, PdfiumError>

Returns all characters that lie within the bounds of the given PdfPageAnnotation in the containing PdfPage, in the order in which they are defined in the document, concatenated into a single string.

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.

Trait Implementations§

source§

impl<'a> Display for PdfPageText<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Drop for PdfPageText<'a>

source§

fn drop(&mut self)

Closes the PdfPageText collection, releasing held memory.

Auto Trait Implementations§

§

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

§

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

§

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

§

impl<'a> Unpin for PdfPageText<'a>

§

impl<'a> !UnwindSafe for PdfPageText<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.