Single entry point for stream filter dispatch.
Normalizes every legal /Filter form — absent, a single name, or an
array of names (with the /F abbreviation), plus the matching
/DecodeParms///DP forms (dict, array of dicts/nulls, absent) — and
applies the decode chain in order.
Two variants serve the two caller postures:
decode/1— strict: unsupported filters and decode failures are errors. For structural streams (xref streams, object streams) whose bytes are useless undecoded.decode_lenient/1— best-effort: any failure returns the raw bytes unchanged. For content extraction, where partial output beats none.
Indirect (%PdfEx.COS.Reference{}) /DecodeParms are treated as "no
parameters" rather than resolved (rare in practice; resolving would require
threading the document through every decode call).
Summary
Functions
Strictly decodes a stream's filter chain. Unsupported filters or decode failures return {:error, reason}.
Best-effort decode: returns the decoded bytes, or the raw bytes unchanged on any failure.
Types
Functions
@spec decode(PdfEx.COS.Stream.t()) :: {:ok, binary()} | {:error, error_reason()}
Strictly decodes a stream's filter chain. Unsupported filters or decode failures return {:error, reason}.
@spec decode_lenient(PdfEx.COS.Stream.t()) :: binary()
Best-effort decode: returns the decoded bytes, or the raw bytes unchanged on any failure.