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;
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
TPdfContentNormalizeOptions.Default enables comment removal, balanced-state validation, Flate compression when beneficial, unsafe-page skipping, and per-page byte and token budgetsSkipUnsafePages to False when any malformed token, unresolved inline-image boundary, unsupported filter, or limit violation shall abort the full saveAllowSignedDocument is explicitly enabled because a full rewrite invalidates existing byte rangessaIncremental is rejected because normalization writes a complete active revision
Options := TPdfContentNormalizeOptions.Default;
Options.SkipUnsafePages := False;
Pdf.SaveAsNormalizedContent('normalized.pdf', Report, Options);