pub struct Resolver<'a> { /* private fields */ }Expand description
Resolves indirect object references, caching parsed objects.
Implementations§
Source§impl<'a> Resolver<'a>
impl<'a> Resolver<'a>
Sourcepub fn with_encryption(
data: &'a [u8],
xref: XrefTable,
encryption: Option<EncryptionState>,
) -> Self
pub fn with_encryption( data: &'a [u8], xref: XrefTable, encryption: Option<EncryptionState>, ) -> Self
Create a resolver with optional encryption state.
Sourcepub fn preload_object_streams(&self)
pub fn preload_object_streams(&self)
Pre-decompress and parse all object streams (ObjStm) in the PDF. This populates the object cache for all objects stored in ObjStms, avoiding per-object decompression during page rendering.
Sourcepub fn resolve(&self, obj_num: u32, _gen_num: u16) -> Result<PdfObj, PdfError>
pub fn resolve(&self, obj_num: u32, _gen_num: u16) -> Result<PdfObj, PdfError>
Resolve an indirect reference to its parsed object.
Sourcepub fn deref(&self, obj: &PdfObj) -> Result<PdfObj, PdfError>
pub fn deref(&self, obj: &PdfObj) -> Result<PdfObj, PdfError>
If obj is a Ref, resolve it. Otherwise return as-is.
Sourcepub fn stream_data(
&self,
obj_num: u32,
gen_num: u16,
) -> Result<Vec<u8>, PdfError>
pub fn stream_data( &self, obj_num: u32, gen_num: u16, ) -> Result<Vec<u8>, PdfError>
Resolve an object and return its decompressed stream data.
Sourcepub fn raw_stream_and_filters(
&self,
obj: &PdfObj,
) -> Result<(Vec<u8>, Vec<Filter>), PdfError>
pub fn raw_stream_and_filters( &self, obj: &PdfObj, ) -> Result<(Vec<u8>, Vec<Filter>), PdfError>
Get the raw (pre-filter) stream bytes and filter list for an object. Used for peeking at JPX metadata before full decode.
Sourcepub fn stream_data_from_obj(&self, obj: &PdfObj) -> Result<Vec<u8>, PdfError>
pub fn stream_data_from_obj(&self, obj: &PdfObj) -> Result<Vec<u8>, PdfError>
Resolve an object and return decompressed stream data, accepting a PdfObj directly.
Sourcepub fn raw_stream_bytes(&self, obj: &PdfObj) -> Option<&[u8]>
pub fn raw_stream_bytes(&self, obj: &PdfObj) -> Option<&[u8]>
Return the raw (undecoded, possibly encrypted) stream bytes for an object reference. Used to parse format-specific headers (e.g. JPEG SOF) before full filter decoding.
Auto Trait Implementations§
impl<'a> !Freeze for Resolver<'a>
impl<'a> !RefUnwindSafe for Resolver<'a>
impl<'a> Send for Resolver<'a>
impl<'a> !Sync for Resolver<'a>
impl<'a> Unpin for Resolver<'a>
impl<'a> UnsafeUnpin for Resolver<'a>
impl<'a> UnwindSafe for Resolver<'a>
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> 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