LinearizeFile

Document manipulation, Miscellaneous functions

Description

Linearizes the specified PDF file for fast web view.

Syntax

Delphi

Function TPDFlib.LinearizeFile(Const InputFileName, Password, OutputFileName: WideString; Options: Integer): Integer;

ActiveX

Function PDFlib::LinearizeFile(InputFileName As String, Password As String, OutputFileName As String, Options As Long) As Long

DLL

int DLLinearizeFile(int InstanceID, const wchar_t * InputFileName, const wchar_t * Password, const wchar_t * OutputFileName, int Options);

Behavior

The first-page section includes annotation dictionaries and their reachable appearances, actions, and resources. Object ordering uses stable O(n log n) work, and deeply connected object graphs do not consume one call frame per reachable object

Set PDF_LINEARIZE_OBJECT_STREAMS in Options for PDF 1.5 or later input to pack eligible second-section non-stream objects into bounded object streams and encode their type 2 entries in a compressed main xref stream. The first-page xref table remains directly readable so initial display does not depend on decoding an object stream. Encrypted input keeps the direct-object layout

InputFileName and OutputFileName may identify the same file. The source bytes are retained before the destination is replaced

Parameters

InputFileNameThe path and file name of the input PDF to transform
PasswordThe optional password to open the input PDF if it is encrypted
OutputFileNameThe path and file name of the linearized PDF that should be created
OptionsZero for direct objects and traditional xref tables, or PDF_LINEARIZE_OBJECT_STREAMS to request object stream packing with a compressed main xref stream

Return values

1Success
2 Input PDF not found 3 Input PDF cannot be read Input PDF password incorrect 4 5 Could not write output file