pub struct PdfLoadLimits { /* private fields */ }Expand description
Parser-internal limits applied while loading a PDF.
The default preserves the historical parser behavior (no caps). Callers that need stricter limits can set individual caps before loading.
Implementations§
Source§impl PdfLoadLimits
impl PdfLoadLimits
Sourcepub fn max_object_depth(self, depth: u32) -> Self
pub fn max_object_depth(self, depth: u32) -> Self
Set the maximum page-tree/object traversal depth.
Sourcepub fn max_image_pixels(self, pixels: u64) -> Self
pub fn max_image_pixels(self, pixels: u64) -> Self
Set the maximum decoded image pixel count.
Sourcepub fn max_stream_bytes(self, max_bytes: u64) -> Self
pub fn max_stream_bytes(self, max_bytes: u64) -> Self
Set the maximum decoded stream size in bytes.
Values above ~4 GB are clamped to u32::MAX - 1 (≈ 4 GB − 1) due to
internal storage as u32. For the intended use-case (decompression-bomb
protection at 32 MB–1 GB), the 4 GB ceiling is more than sufficient.
Any call to [Stream::decoded] or [Stream::decoded_image] that
produces more bytes than max_bytes returns
Err(DecodeFailure::StreamTooLarge { observed, limit }).
Trait Implementations§
Source§impl Clone for PdfLoadLimits
impl Clone for PdfLoadLimits
Source§fn clone(&self) -> PdfLoadLimits
fn clone(&self) -> PdfLoadLimits
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PdfLoadLimits
impl Debug for PdfLoadLimits
Source§impl Default for PdfLoadLimits
impl Default for PdfLoadLimits
impl Copy for PdfLoadLimits
Auto Trait Implementations§
impl Freeze for PdfLoadLimits
impl RefUnwindSafe for PdfLoadLimits
impl Send for PdfLoadLimits
impl Sync for PdfLoadLimits
impl Unpin for PdfLoadLimits
impl UnsafeUnpin for PdfLoadLimits
impl UnwindSafe for PdfLoadLimits
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