Skip to main content

decode_stream

Function decode_stream 

Source
pub fn decode_stream(stream: &Stream) -> Result<Vec<u8>, PdfError>
Expand description

Apply the stream’s /Filter (if any) to recover the raw payload.

Generic decompression filters land here: FlateDecode (§7.4.4), LZWDecode (§7.4.4.2 — round 98), ASCII85Decode (§7.4.3), ASCIIHexDecode (§7.4.2), and RunLengthDecode (§7.4.5), in both the single-Name and the Array (filter-chain) forms (§7.4.1). Filters are applied in array order so a chain such as [/ASCII85Decode /LZWDecode] (§7.4.4 Example 2) round-trips.

Terminal image codec filters (DCTDecode, JPXDecode, JBIG2Decode, CCITTFaxDecode) are not decoded here — they surface to the dedicated round-23 / round-35 image walkers that hand their opaque payload to a codec crate. A /Filter naming one of those is reported as unsupported rather than silently mangled.