phpdftk API Documentation

Jbig2Filter
in package
implements FilterInterface

FinalYes

JBIG2Decode filter — ISO 14492 / ITU-T T.88 codec.

Encodes/decodes JBIG2-compressed bitonal image data. JBIG2 is a complex multi-segment format supporting symbol dictionaries, text regions, halftone regions, and generic regions with arithmetic or MMR coding.

This implementation handles the most common PDF JBIG2 patterns:

  1. Generic regions with MMR coding (internally Group 4 fax)
  2. Immediate lossless generic regions
  3. Page information segments for dimensions

Encoding produces MMR-coded immediate lossless generic regions, wrapping CCITTFax Group 4 data in JBIG2 segment structure.

For complex JBIG2 streams (symbol dictionaries, arithmetic coding), decoding falls back to the jbig2dec CLI tool if available, otherwise returns the raw data unchanged.

PDF-embedded JBIG2 streams do NOT include the file header — they contain only segment data. Global segments (symbol dictionaries) are provided separately via /JBIG2Globals in /DecodeParms.

Tags
see
https://www.itu.int/rec/T-REC-T.88

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([string $globals = '' ][, int $width = 0 ][, int $height = 0 ]) : mixed
Parameters
$globals : string = ''

Optional JBIG2 global segments data (from /JBIG2Globals)

$width : int = 0

Image width in pixels (required for encoding)

$height : int = 0

Image height in pixels (required for encoding)

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