Struct PdfDocument

Source
pub struct PdfDocument<R: Read + Seek> { /* private fields */ }
Expand description

High-level PDF document interface

Implementations§

Source§

impl<R: Read + Seek> PdfDocument<R>

Source

pub fn new(reader: PdfReader<R>) -> Self

Create a new PDF document from a reader

Source

pub fn version(&self) -> ParseResult<String>

Get the PDF version

Source

pub fn page_count(&self) -> ParseResult<u32>

Get the number of pages

Source

pub fn metadata(&self) -> ParseResult<DocumentMetadata>

Get document metadata

Source

pub fn get_page(&self, index: u32) -> ParseResult<ParsedPage>

Get a page by index (0-based)

Source

pub fn get_object(&self, obj_num: u32, gen_num: u16) -> ParseResult<PdfObject>

Get an object by reference

Source

pub fn resolve(&self, obj: &PdfObject) -> ParseResult<PdfObject>

Resolve a reference

Source

pub fn get_page_content_streams( &self, page: &ParsedPage, ) -> ParseResult<Vec<Vec<u8>>>

Get content streams for a page

Source

pub fn extract_text(&self) -> ParseResult<Vec<ExtractedText>>

Extract text from all pages

Source

pub fn extract_text_from_page( &self, page_index: u32, ) -> ParseResult<ExtractedText>

Extract text from a specific page

Source

pub fn extract_text_with_options( &self, options: ExtractionOptions, ) -> ParseResult<Vec<ExtractedText>>

Extract text with custom options

Auto Trait Implementations§

§

impl<R> !Freeze for PdfDocument<R>

§

impl<R> !RefUnwindSafe for PdfDocument<R>

§

impl<R> !Send for PdfDocument<R>

§

impl<R> !Sync for PdfDocument<R>

§

impl<R> Unpin for PdfDocument<R>
where R: Unpin,

§

impl<R> !UnwindSafe for PdfDocument<R>

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