pub struct PdfDocument { /* private fields */ }Expand description
Loaded PDF handle ready for page-by-page extraction.
Implementations§
Source§impl PdfDocument
impl PdfDocument
Sourcepub fn open(path: &Path, passwords: &[String]) -> Result<Self, PdfGrepError>
pub fn open(path: &Path, passwords: &[String]) -> Result<Self, PdfGrepError>
Load a PDF from a path, attempting each passwords entry in order if
the file is encrypted. Returns PdfGrepError::Encrypted when no
password succeeds.
§Errors
PdfGrepError::Ioon file-open failure.PdfGrepError::Pdfonlopdfparser failure.PdfGrepError::Encryptedon encrypted PDF with no successful password.
Sourcepub fn from_bytes(
bytes: &[u8],
passwords: &[String],
) -> Result<Self, PdfGrepError>
pub fn from_bytes( bytes: &[u8], passwords: &[String], ) -> Result<Self, PdfGrepError>
Load a PDF from bytes (for stdin handling).
§Errors
PdfGrepError::Pdfon parser failure.PdfGrepError::Encryptedif encrypted and no password works.
Sourcepub fn page_numbers(&self) -> &[u32]
pub fn page_numbers(&self) -> &[u32]
Sorted list of 1-indexed page numbers in this PDF.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PdfDocument
impl !RefUnwindSafe for PdfDocument
impl Send for PdfDocument
impl Sync for PdfDocument
impl Unpin for PdfDocument
impl UnsafeUnpin for PdfDocument
impl !UnwindSafe for PdfDocument
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more