PDFium Delphi Component Docs

SaveAsNormalizedContent method

Component: TPdf  ·  Unit: PDFium
Writes a full PDF copy whose page content streams use validated canonical token spacing

Syntax

function SaveAsNormalizedContent(Stream: TStream; out Report: TPdfContentNormalizeReport; const Options: TPdfContentNormalizeOptions; SaveOption: TSaveOption = saNoIncremental; PdfVersion: TPdfVersion = pvUnknown): Boolean;

function SaveAsNormalizedContent(const FileName: string; out Report: TPdfContentNormalizeReport; const Options: TPdfContentNormalizeOptions; SaveOption: TSaveOption = saNoIncremental; PdfVersion: TPdfVersion = pvUnknown): Boolean;

Description

The normal PDFium save path remains the semantic source for current in-memory edits

Each page /Contents array is decoded in order and joined with the same inter-stream separator used by PDFium

The tokenizer preserves literal strings, hex strings, names, arrays, dictionaries, inline-image payloads, and unknown operators while canonicalizing token separation

Comments are removed by default and balanced q/Q, BT/ET, marked-content, compatibility, array, and dictionary scopes are validated

Successful pages receive one new content stream and unreferenced source content objects are removed from the rewritten active object graph

The report includes normalized and skipped pages, input and output stream counts, coalesced arrays, tokens, comments, inline images, unknown operators, and byte counts

Policies and limits

Example

Options := TPdfContentNormalizeOptions.Default;
Options.SkipUnsafePages := False;
Pdf.SaveAsNormalizedContent('normalized.pdf', Report, Options);

See Also

SaveAs, SaveAsObjectStream