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 open_with_password(
bytes: &[u8],
password: &[u8],
) -> Result<Self::Document, Self::Error>
fn open_with_password( bytes: &[u8], password: &[u8], ) -> Result<Self::Document, Self::Error>
Parse PDF bytes into a document, decrypting with the given password. 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_trim_box(
doc: &Self::Document,
page: &Self::Page,
) -> Result<Option<BBox>, Self::Error>
fn page_trim_box( doc: &Self::Document, page: &Self::Page, ) -> Result<Option<BBox>, Self::Error>
Get the TrimBox for a page, if explicitly set. Read more
Source§fn page_bleed_box(
doc: &Self::Document,
page: &Self::Page,
) -> Result<Option<BBox>, Self::Error>
fn page_bleed_box( doc: &Self::Document, page: &Self::Page, ) -> Result<Option<BBox>, Self::Error>
Get the BleedBox for a page, if explicitly set. Read more
Source§fn page_art_box(
doc: &Self::Document,
page: &Self::Page,
) -> Result<Option<BBox>, Self::Error>
fn page_art_box( doc: &Self::Document, page: &Self::Page, ) -> Result<Option<BBox>, Self::Error>
Get the ArtBox 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 document_metadata(
doc: &Self::Document,
) -> Result<DocumentMetadata, Self::Error>
fn document_metadata( doc: &Self::Document, ) -> Result<DocumentMetadata, Self::Error>
Extract document-level metadata from the PDF /Info dictionary. Read more
Source§fn document_bookmarks(
doc: &Self::Document,
) -> Result<Vec<Bookmark>, Self::Error>
fn document_bookmarks( doc: &Self::Document, ) -> Result<Vec<Bookmark>, Self::Error>
Extract the document outline (bookmarks / table of contents). Read more
Source§fn document_form_fields(
doc: &Self::Document,
) -> Result<Vec<FormField>, Self::Error>
fn document_form_fields( doc: &Self::Document, ) -> Result<Vec<FormField>, Self::Error>
Extract form fields from the document’s AcroForm dictionary. Read more
Source§fn document_signatures(
doc: &Self::Document,
) -> Result<Vec<SignatureInfo>, Self::Error>
fn document_signatures( doc: &Self::Document, ) -> Result<Vec<SignatureInfo>, Self::Error>
Extract digital signature information from the document. Read more
Source§fn document_structure_tree(
doc: &Self::Document,
) -> Result<Vec<StructElement>, Self::Error>
fn document_structure_tree( doc: &Self::Document, ) -> Result<Vec<StructElement>, Self::Error>
Extract the document’s structure tree from
/StructTreeRoot. Read moreSource§fn page_annotations(
doc: &Self::Document,
page: &Self::Page,
) -> Result<Vec<Annotation>, Self::Error>
fn page_annotations( doc: &Self::Document, page: &Self::Page, ) -> Result<Vec<Annotation>, Self::Error>
Extract annotations from a page. Read more
Source§fn page_hyperlinks(
doc: &Self::Document,
page: &Self::Page,
) -> Result<Vec<Hyperlink>, Self::Error>
fn page_hyperlinks( doc: &Self::Document, page: &Self::Page, ) -> Result<Vec<Hyperlink>, Self::Error>
Extract hyperlinks from a page. 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
Source§fn extract_image_content(
doc: &Self::Document,
page: &Self::Page,
image_name: &str,
) -> Result<ImageContent, Self::Error>
fn extract_image_content( doc: &Self::Document, page: &Self::Page, image_name: &str, ) -> Result<ImageContent, Self::Error>
Extract image content (raw bytes) from a named image XObject on a page. 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