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
impl PdfBackend for LopdfBackend
Source§type Document = LopdfDocument
type Document = LopdfDocument
The parsed PDF document type.
Source§type Error = BackendError
type Error = BackendError
Backend-specific error type, convertible to
PdfError.Source§fn open(bytes: &[u8]) -> Result<Self::Document, Self::Error>
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
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>
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>
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>
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>
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>
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§
impl Freeze for LopdfBackend
impl RefUnwindSafe for LopdfBackend
impl Send for LopdfBackend
impl Sync for LopdfBackend
impl Unpin for LopdfBackend
impl UnsafeUnpin for LopdfBackend
impl UnwindSafe for LopdfBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more