NormalizeContentStreams

Document optimization, content streams, performance

Description

Parses every page content layer in the selected range, emits canonical token spacing and numeric forms, and stores changed layers with Flate compression

Syntax

Delphi

Function TPDFlib.NormalizeContentStreams(Const PageRange: WideString= ''): Integer;

Parameters

PageRangeA 1-based page range such as 1,3,5-7, or an empty string for every page

Return values

The number of content layers whose decoded bytes changed, or 0 when no layer required normalization, the range was invalid, or every candidate layer failed parsing

Remarks

Operator names, decoded string values, text operations, and the complete BI through EI inline image span remain unchanged

Comments and redundant whitespace are removed because they do not affect PDF painting semantics

A structurally malformed layer remains byte-identical, and failures in one layer do not block other pages

The operation reports progress, responds to Abort between pages, and restores the previously selected page

Running the method again is idempotent and returns 0 when every selected layer is already canonical

Example

ChangedLayers:= PDF.NormalizeContentStreams('1-20');
Writeln(ChangedLayers);

See also

CompressContent, CompressPage, SetOptimizeContentStreams