pub struct PdfReader<R: Read + Seek> { /* private fields */ }Expand description
High-level PDF reader
Implementations§
Source§impl<R: Read + Seek> PdfReader<R>
impl<R: Read + Seek> PdfReader<R>
Sourcepub fn options(&self) -> &ParseOptions
pub fn options(&self) -> &ParseOptions
Get parsing options
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Check if the PDF is encrypted
Sourcepub fn is_unlocked(&self) -> bool
pub fn is_unlocked(&self) -> bool
Check if the PDF is unlocked (can read encrypted content)
Sourcepub fn encryption_handler_mut(&mut self) -> Option<&mut EncryptionHandler>
pub fn encryption_handler_mut(&mut self) -> Option<&mut EncryptionHandler>
Get mutable access to encryption handler
Sourcepub fn encryption_handler(&self) -> Option<&EncryptionHandler>
pub fn encryption_handler(&self) -> Option<&EncryptionHandler>
Get access to encryption handler
Sourcepub fn unlock_with_password(&mut self, password: &str) -> ParseResult<bool>
pub fn unlock_with_password(&mut self, password: &str) -> ParseResult<bool>
Try to unlock PDF with password
Sourcepub fn try_empty_password(&mut self) -> ParseResult<bool>
pub fn try_empty_password(&mut self) -> ParseResult<bool>
Try to unlock with empty password
Source§impl PdfReader<File>
impl PdfReader<File>
Sourcepub fn open<P: AsRef<Path>>(path: P) -> ParseResult<Self>
pub fn open<P: AsRef<Path>>(path: P) -> ParseResult<Self>
Open a PDF file from a path
Sourcepub fn open_strict<P: AsRef<Path>>(path: P) -> ParseResult<Self>
pub fn open_strict<P: AsRef<Path>>(path: P) -> ParseResult<Self>
Open a PDF file from a path with strict parsing
Sourcepub fn open_with_options<P: AsRef<Path>>(
path: P,
options: ParseOptions,
) -> ParseResult<Self>
pub fn open_with_options<P: AsRef<Path>>( path: P, options: ParseOptions, ) -> ParseResult<Self>
Open a PDF file from a path with custom parsing options
Sourcepub fn open_document<P: AsRef<Path>>(path: P) -> ParseResult<PdfDocument<File>>
pub fn open_document<P: AsRef<Path>>(path: P) -> ParseResult<PdfDocument<File>>
Open a PDF file as a PdfDocument
Source§impl<R: Read + Seek> PdfReader<R>
impl<R: Read + Seek> PdfReader<R>
Sourcepub fn new(reader: R) -> ParseResult<Self>
pub fn new(reader: R) -> ParseResult<Self>
Create a new PDF reader from a reader
Sourcepub fn new_with_options(reader: R, options: ParseOptions) -> ParseResult<Self>
pub fn new_with_options(reader: R, options: ParseOptions) -> ParseResult<Self>
Create a new PDF reader with custom parsing options
Sourcepub fn version(&self) -> &PdfVersion
pub fn version(&self) -> &PdfVersion
Get the PDF version
Sourcepub fn catalog(&mut self) -> ParseResult<&PdfDictionary>
pub fn catalog(&mut self) -> ParseResult<&PdfDictionary>
Get the document catalog
Sourcepub fn info(&mut self) -> ParseResult<Option<&PdfDictionary>>
pub fn info(&mut self) -> ParseResult<Option<&PdfDictionary>>
Get the document info dictionary
Sourcepub fn get_object(
&mut self,
obj_num: u32,
gen_num: u16,
) -> ParseResult<&PdfObject>
pub fn get_object( &mut self, obj_num: u32, gen_num: u16, ) -> ParseResult<&PdfObject>
Get an object by reference
Sourcepub fn resolve<'a>(
&'a mut self,
obj: &'a PdfObject,
) -> ParseResult<&'a PdfObject>
pub fn resolve<'a>( &'a mut self, obj: &'a PdfObject, ) -> ParseResult<&'a PdfObject>
Resolve a reference to get the actual object
Sourcepub fn resolve_stream_length(
&mut self,
obj: &PdfObject,
) -> ParseResult<Option<usize>>
pub fn resolve_stream_length( &mut self, obj: &PdfObject, ) -> ParseResult<Option<usize>>
Resolve a stream length reference to get the actual length value This is a specialized method for handling indirect references in stream Length fields
Sourcepub fn pages(&mut self) -> ParseResult<&PdfDictionary>
pub fn pages(&mut self) -> ParseResult<&PdfDictionary>
Get the page tree root
Sourcepub fn page_count(&mut self) -> ParseResult<u32>
pub fn page_count(&mut self) -> ParseResult<u32>
Get the number of pages
Sourcepub fn metadata(&mut self) -> ParseResult<DocumentMetadata>
pub fn metadata(&mut self) -> ParseResult<DocumentMetadata>
Get metadata from the document
Sourcepub fn get_page(&mut self, _index: u32) -> ParseResult<&ParsedPage>
pub fn get_page(&mut self, _index: u32) -> ParseResult<&ParsedPage>
Get a specific page by index (0-based)
Note: This method is currently not implemented due to borrow checker constraints. The page_tree needs mutable access to both itself and the reader, which requires a redesign of the architecture. Use PdfDocument instead for page access.
Sourcepub fn get_all_pages(&mut self) -> ParseResult<Vec<ParsedPage>>
pub fn get_all_pages(&mut self) -> ParseResult<Vec<ParsedPage>>
Get all pages
Sourcepub fn into_document(self) -> PdfDocument<R>
pub fn into_document(self) -> PdfDocument<R>
Convert this reader into a PdfDocument for easier page access
Sourcepub fn clear_parse_context(&mut self)
pub fn clear_parse_context(&mut self)
Clear the parse context (useful to avoid false circular references)
Sourcepub fn parse_context_mut(&mut self) -> &mut StackSafeContext
pub fn parse_context_mut(&mut self) -> &mut StackSafeContext
Get a mutable reference to the parse context
Auto Trait Implementations§
impl<R> Freeze for PdfReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for PdfReader<R>where
R: RefUnwindSafe,
impl<R> Send for PdfReader<R>where
R: Send,
impl<R> Sync for PdfReader<R>where
R: Sync,
impl<R> Unpin for PdfReader<R>where
R: Unpin,
impl<R> UnwindSafe for PdfReader<R>where
R: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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