Skip to main content

LopdfBackend

Struct LopdfBackend 

Source
pub struct LopdfBackend;
Expand description

The lopdf-based PDF backend.

Provides PDF parsing via lopdf::Document. This is the default backend used by pdfplumber-rs.

§Example

use pdfplumber_parse::lopdf_backend::LopdfBackend;
use pdfplumber_parse::PdfBackend;

let doc = LopdfBackend::open(pdf_bytes)?;
let count = LopdfBackend::page_count(&doc);
let page = LopdfBackend::get_page(&doc, 0)?;

Trait Implementations§

Source§

impl PdfBackend for LopdfBackend

Source§

type Document = LopdfDocument

The parsed PDF document type.
Source§

type Page = LopdfPage

A reference to a single page within a document.
Source§

type Error = BackendError

Backend-specific error type, convertible to PdfError.
Source§

fn open(bytes: &[u8]) -> Result<Self::Document, Self::Error>

Parse PDF bytes into a document. Read more
Source§

fn page_count(doc: &Self::Document) -> usize

Return the number of pages in the document.
Source§

fn get_page( doc: &Self::Document, index: usize, ) -> Result<Self::Page, Self::Error>

Access a page by 0-based index. Read more
Source§

fn page_media_box( doc: &Self::Document, page: &Self::Page, ) -> Result<BBox, Self::Error>

Get the MediaBox for a page. Read more
Source§

fn page_crop_box( doc: &Self::Document, page: &Self::Page, ) -> Result<Option<BBox>, Self::Error>

Get the CropBox for a page, if explicitly set. Read more
Source§

fn page_rotate( doc: &Self::Document, page: &Self::Page, ) -> Result<i32, Self::Error>

Get the page rotation angle in degrees. Read more
Source§

fn interpret_page( doc: &Self::Document, page: &Self::Page, handler: &mut dyn ContentHandler, options: &ExtractOptions, ) -> Result<(), Self::Error>

Interpret the page’s content stream, calling back into the handler. Read more

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.