pub struct OpenOptions {
pub parsing_mode: ParsingMode,
pub password: Option<String>,
pub max_decompressed_stream_size: u64,
pub max_compression_ratio: u32,
pub max_operators_per_page: u64,
pub max_endstream_scan_distance: u64,
}Expand description
Options for opening a PDF document.
All fields have sensible defaults via the Default implementation.
Soft limits can be adjusted for trusted inputs that exceed the defaults.
Fields§
§parsing_mode: ParsingModeParsing mode (default: ParsingMode::Lenient).
password: Option<String>Password for encrypted documents (default: None).
max_decompressed_stream_size: u64Maximum decompressed stream size in bytes (default: 256 MB).
Prevents decompression bombs.
max_compression_ratio: u32Maximum compression ratio before aborting (default: 1000:1).
A ratio exceeding this strongly indicates a zip bomb.
max_operators_per_page: u64Maximum content stream operators per page (default: 10,000,000).
max_endstream_scan_distance: u64Maximum distance to scan for endstream keyword (default: 16 MB).
Implementations§
Source§impl OpenOptions
impl OpenOptions
Sourcepub fn with_parsing_mode(self, mode: ParsingMode) -> Self
pub fn with_parsing_mode(self, mode: ParsingMode) -> Self
Set the parsing mode.
Sourcepub fn with_password(self, password: impl Into<String>) -> Self
pub fn with_password(self, password: impl Into<String>) -> Self
Set the password for encrypted documents.
Sourcepub fn with_max_decompressed_stream_size(self, size: u64) -> Self
pub fn with_max_decompressed_stream_size(self, size: u64) -> Self
Set the maximum decompressed stream size in bytes.
Sourcepub fn with_max_compression_ratio(self, ratio: u32) -> Self
pub fn with_max_compression_ratio(self, ratio: u32) -> Self
Set the maximum compression ratio before aborting.
Sourcepub fn with_max_operators_per_page(self, count: u64) -> Self
pub fn with_max_operators_per_page(self, count: u64) -> Self
Set the maximum content stream operators per page.
Sourcepub fn with_max_endstream_scan_distance(self, distance: u64) -> Self
pub fn with_max_endstream_scan_distance(self, distance: u64) -> Self
Set the maximum distance to scan for endstream.
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more