View Source Pdf.Reader.Filter.LZW (ExPDF v1.0.1)

LZWDecode filter โ€” decodes LZW compressed data as specified in PDF ยง7.4.4.

Code parameters

  • Initial code width: 9 bits.
  • Clear code: 256 (resets the table to the initial state).
  • EOD code: 257 (end of data).
  • Code width increases from 9 to 12 bits as the table grows.

EarlyChange

Controlled by the "EarlyChange" key in DecodeParms (default: 1).

  • EarlyChange 1 (PDF default): the code width increases when the table has 2^current_width - 1 entries (i.e., BEFORE the table is full).
  • EarlyChange 0: width increases AFTER the table reaches 2^current_width entries (i.e., when the NEXT code would overflow).

Predictor

LZW supports the same predictor params as FlateDecode. After decoding the LZW bit stream the predictor is applied via Pdf.Reader.Filter.Flate's predictor logic (delegated โ€” same code path).

Summary

Functions

Decode LZW-compressed bytes. params may include "EarlyChange" (default 1).

Functions

@spec decode(binary(), map()) :: {:ok, binary()} | {:error, term()}

Decode LZW-compressed bytes. params may include "EarlyChange" (default 1).