phpdftk API Documentation

LzwFilter
in package
implements FilterInterface

FinalYes

LZW filter — decode/encode per ISO 32000-2 §7.4.4.2.

PDF LZW uses MSB-first bit packing, variable code widths from 9 to 12 bits, clear code = 256, EOD code = 257.

The "early change" convention is used: code width increases immediately after the entry that causes nextCode to reach 2^codeSize, so the NEXT code read/written uses the wider width.

Table of Contents

Interfaces

FilterInterface
Symmetric encode/decode contract for PDF stream filters (ISO 32000-2 §7.4).

Methods

__construct()  : mixed
decode()  : string
encode()  : string

Methods

__construct()

public __construct([int $earlyChange = 1 ]) : mixed
Parameters
$earlyChange : int = 1

When 1 (default), code-size transition uses "early change" convention per PDF spec. When 0, the transition happens one code later.

decode()

public decode(string $data) : string
Parameters
$data : string
Return values
string

encode()

public encode(string $data) : string
Parameters
$data : string
Return values
string

        
On this page

Search results