pub struct PdfStream {
pub dict: PdfDictionary,
pub data: Vec<u8>,
}Expand description
PDF Stream object - Dictionary with associated binary data.
Streams are used for large data blocks like page content, images, fonts, etc. The dictionary describes the stream’s properties (length, filters, etc.).
§Structure
dict: Stream dictionary with metadatadata: Raw stream bytes (possibly compressed)
§Common Stream Types
- Content streams: Page drawing instructions
- Image XObjects: Embedded images
- Font programs: Embedded font data
- Form XObjects: Reusable graphics
§Example
use oxidize_pdf::parser::objects::{PdfStream, PdfDictionary};
use oxidize_pdf::parser::ParseOptions;
// Get decompressed data
let options = ParseOptions::default();
let decoded = stream.decode(&options)?;
println!("Decoded {} bytes", decoded.len());
// Access raw data
let raw = stream.raw_data();
println!("Raw {} bytes", raw.len());Fields§
§dict: PdfDictionaryStream dictionary containing Length, Filter, and other properties
data: Vec<u8>Raw stream data (may be compressed)
Implementations§
Source§impl PdfStream
impl PdfStream
Sourcepub fn decode(&self, options: &ParseOptions) -> ParseResult<Vec<u8>>
pub fn decode(&self, options: &ParseOptions) -> ParseResult<Vec<u8>>
Get the decompressed stream data.
Automatically applies filters specified in the stream dictionary (FlateDecode, ASCIIHexDecode, etc.) to decompress the data.
§Arguments
options- Parse options controlling error recovery behavior
§Returns
The decoded/decompressed stream bytes.
§Errors
Returns an error if:
- Unknown filter is specified
- Decompression fails
- Filter parameters are invalid
§Example
let options = ParseOptions::default();
match stream.decode(&options) {
Ok(data) => println!("Decoded {} bytes", data.len()),
Err(e) => println!("Decode error: {}", e),
}Trait Implementations§
impl StructuralPartialEq for PdfStream
Auto Trait Implementations§
impl Freeze for PdfStream
impl RefUnwindSafe for PdfStream
impl Send for PdfStream
impl Sync for PdfStream
impl Unpin for PdfStream
impl UnwindSafe for PdfStream
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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