THPDFJBIG2Encoder.EncodePagesToByteArrays Method
Encodes all supplied bilevel pages as one trained JBIG2 batch and returns shared global data
Declaration
Function EncodePagesToByteArrays(Const Pages: TJBIG2BatchPageArray;
Var ImageData: TJBIG2EncodedPageArray;
Var GlobalData: TJBIG2ByteArray;
Var Statistics: TJBIG2BatchEncodeStatistics;
Const Options: TJBIG2EncodeOptions;
Const BatchOptions: TJBIG2BatchEncodeOptions): Boolean;
Unit
HPDFJBIG2
Behavior
- Validates every dimension, scanline width, page limit, and aggregate pixel limit before encoding
- Uses the registered external batch backend first and trains repeated symbols across the complete page set
- With
Lossless=True, the built-in external backend shares only bit-identical symbols and preserves their integer pixel positions, including isolated dots whenLossyLevel=0 - Explicit nonnegative
RefinementLevelrequests use exact shared symbols; approximate classification remains available withLossless=Falseand the default refinement level of -1 - Free Pascal native encoding requires the matching codec DLL with exact-batch capability; older codec DLLs leave JBIG2 on the Pascal fallback while other complete codecs remain available
- Uses the native symbol accumulator when the external backend is unavailable and
AllowNativeFallbackis enabled - Returns page streams in input order and one nonempty global dictionary shared by the batch
- Clears outputs and fails without partial results when validation or encoding fails
Statistics
TJBIG2BatchEncodeStatistics reports backend choice, page and input sizes, page and global output bytes, native symbol count, and budget rejection