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_core::parser::objects::{PdfStream, PdfDictionary};
// Get decompressed data
let decoded = stream.decode()?;
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) -> ParseResult<Vec<u8>>
pub fn decode(&self) -> ParseResult<Vec<u8>>
Get the decompressed stream data.
Automatically applies filters specified in the stream dictionary (FlateDecode, ASCIIHexDecode, etc.) to decompress the data.
§Returns
The decoded/decompressed stream bytes.
§Errors
Returns an error if:
- Unknown filter is specified
- Decompression fails
- Filter parameters are invalid
§Example
match stream.decode() {
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