PDFium Delphi Component Docs

SaveAsLinearized method

Component: TPdf  ·  Unit: PDFium
Writes a standards-compliant Fast Web View copy of the current PDF to a stream or file

Syntax

function SaveAsLinearized(Stream: TStream; Option: TSaveOption = saNone; PdfVersion: TPdfVersion = pvUnknown): Boolean;

function SaveAsLinearized(const FileName: string; Option: TSaveOption = saNone; PdfVersion: TPdfVersion = pvUnknown): Boolean;

StreamTStream that receives the complete linearized PDF
FileNameOutput path replaced only after a sibling temporary file succeeds
OptionNormal save option or saRemoveSecurity; saIncremental is rejected
PdfVersionOutput version from PDF 1.2 upward, or pvUnknown to preserve the current version

Return Value

Returns True when the linearized output was completed successfully

Description

The method first uses the normal PDFium save path as the semantic source, then rewrites the active object graph into Annex F order

Document-level and first-page objects are placed ahead of later page data, followed by a second cross-reference section and the remaining objects

Page-offset and shared-object hint tables use high-bit-first encoding and are Flate-compressed when compression reduces their size

Active xref-stream and object-stream members are materialised as ordinary indirect objects before references are renumbered

The output is designed for HTTP Range readers and can expose a requested page without transferring the complete document

Constraints

Example

// Create range-friendly output for web delivery
Pdf.SaveAsLinearized('report-web.pdf');

See Also

SaveAs, TPdfProgressiveDocument