Skip to main content

Document

Struct Document 

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

An open PDF document.

Implementations§

Source§

impl<'a> Document<'a>

Source

pub fn open(data: &'a [u8]) -> Result<Document<'a>>

Open with default pith_inflate::Limits.

Source

pub fn open_with_limits(data: &'a [u8], limits: Limits) -> Result<Document<'a>>

Open with explicit decompression limits.

Source

pub fn xref_was_rebuilt(&self) -> bool

true when the xref table could not be parsed and was rebuilt by scanning for object headers.

Source

pub fn is_encrypted(&self) -> bool

true when the trailer declares /Encrypt. Text extraction refuses encrypted documents with Error::Unsupported-bearing errors.

Source

pub fn encryption(&self) -> Option<Ref>

The /Encrypt object reference, if present.

Source

pub fn pages(&self) -> usize

Page count.

Source

pub fn object(&self, r: Ref) -> Result<Obj>

Resolve and parse one indirect object (public for inspection; the returned object is owned).

Source

pub fn page_text(&self, page: usize) -> Result<String>

Extract one page’s text.

Source

pub fn text(&self) -> Result<String>

Extract the whole document’s text, pages joined by \x0c (form feed). The first failing page aborts with Error::Page.

Auto Trait Implementations§

§

impl<'a> !Freeze for Document<'a>

§

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

§

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

§

impl<'a> Send for Document<'a>

§

impl<'a> Unpin for Document<'a>

§

impl<'a> UnsafeUnpin for Document<'a>

§

impl<'a> UnwindSafe for Document<'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, 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.