Skip to main content

Crate rpdfium_codec

Crate rpdfium_codec 

Source
Expand description

Image codecs and stream decode filters for rpdfium — a faithful Rust port of PDFium.

This crate implements the PDF stream decode filters:

  • ASCII85Decode — base-85 decoding
  • ASCIIHexDecode — hexadecimal decoding
  • RunLengthDecode — run-length decoding
  • LZWDecode — LZW decompression (PDF variant)
  • FlateDecode — zlib/deflate decompression with predictor support
  • DCTDecode — JPEG decompression
  • CCITTFaxDecode — Group 3 and Group 4 fax decompression
  • JBIG2Decode — JBIG2 decompression via hayro-jbig2
  • JPXDecode — JPEG 2000 decompression via hayro-jpeg2000

The apply_filter_chain function applies multiple filters in sequence, enforcing security limits on chain length and output size.

§Design Principles

  • #![forbid(unsafe_code)]
  • All deep operations are iterative (explicit stacks), never recursive.
  • Security limits enforced: MAX_FILTER_CHAIN_LENGTH, decompressed size limits.

Re-exports§

pub use error::DecodeError;
pub use scanline::DctScanlineDecoder;
pub use scanline::FlateScanlineDecoder;
pub use scanline::RandomAccessDecoder;
pub use scanline::ScanlineDecoder;
pub use streaming::StreamingDecoder;
pub use streaming::StreamingDecoderType;
pub use streaming::create_streaming_decoder;

Modules§

basic
Basic stream filters — ASCII85, ASCIIHex, RunLength.
error
Error types for the codec crate.
fax
CCITTFaxDecode filter — Group 3 and Group 4 fax decompression.
flate
Flate/LZW decode filters with predictor support.
jbig2
JBIG2Decode filter — JBIG2 decompression.
jpeg
DCTDecode filter — JPEG decompression.
jpx
JPXDecode (JPEG 2000) filter — decodes JPEG 2000 codestreams and JP2 containers.
pipeline
Filter pipeline — applies multiple decode filters in sequence.
scanline
Scanline-based image decoding — yields one row of pixels at a time.
streaming
Streaming (incremental) decode API for large image decompression.

Structs§

FilterParams
Parameters for decode filters.

Enums§

DecodeFilter
Available PDF stream decode filters.

Functions§

apply_filter_chain
Apply a chain of decode filters in sequence.
decode
Decode data using a single filter with the given parameters.