SaveToFileOptions
Document management
Description
Saves the selected document to a file while applying a whole bundle of save options in one call: content, font and image compression, content-stream optimisation, garbage collection, object stream packing, modification-date retention and linearisation. Returns 1 only when the save and every requested post-processing stage succeed, otherwise 0
Syntax
Delphi
Function TPDFlib.SaveToFileOptions(Const FileName: WideString; Const Options: TPDFlibSaveOptions): Integer;
Behaviour
When both Options.Linearize and Options.PackObjectStreams are true, the final PDF keeps Fast Web View ordering while packing eligible second-section objects and writing a compressed main xref stream. The temporary packed save is read safely before the same destination path is replaced by the linearised result
Save options do not change the document's default settings for later saves. Compression may rewrite streams in the selected document, so a later save can reuse those compressed streams
Parameters
FileName is the destination path. Options controls compression, linearisation, modification-date retention, content optimisation, garbage collection, and object stream packing
Return values
Returns 1 when the save and every requested post-processing stage succeed; 0 otherwise
Remarks
Object stream linearisation requires PDF 1.5 or later. Encrypted input retains direct objects during the linearisation stage