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 optimization, garbage collection, object stream packing, modification-date retention and linearization. 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;
Behavior
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 destination is replaced only after every requested stage succeeds
Save options do not change the document's default settings for later saves. Compression can rewrite streams in the selected document, so a later save can reuse those compressed streams
Parameters
FileName is the destination path. Options controls compression, linearization, modification-date retention, content optimization, garbage collection, and object stream packing
Return values
Returns 1 when the save and every requested post-processing stage succeed, otherwise 0
Remarks
Object stream linearization requires PDF 1.5 or later. Password-encrypted documents retain encryption and use direct objects during linearization. Linearization requires a credential the linearizer can use and rejects documents protected by a PDF MAC