LoadFromFile

Document management

Description

Loads a PDF document from a file on disk. If the function succeeds, the loaded document is selected and its DocumentID can be retrieved using the SelectedDocument function

If the supplied password is rejected and OnPassword is assigned, the handler may provide another credential or cancel the load

For password-encrypted PDFs using revision 4 of the standard security handler, the reader follows the crypt filters selected for strings, ordinary streams, embedded files, and streams with an explicit /Crypt filter. The selected filters can mix RC4, AESV2, and Identity

Password-encrypted revision 5 and 6 PDFs can use AESV3 with Identity or named clear stream filters. Revision 7 also selects AESV3 or AESV4 per filter when the document mixes CBC and GCM encryption

Public-key PDFs can use a named clear filter declared as /CFM /None for unencrypted strings or streams alongside a supported recipient filter

Syntax

Delphi

Function TPDFlib.LoadFromFile(Const FileName, Password: WideString): Integer;

ActiveX

Function PDFlib::LoadFromFile(FileName As String, Password As String) As Long

DLL

int DLLoadFromFile(int InstanceID, const wchar_t* FileName, const wchar_t* Password);
int DLLoadFromFileA(int InstanceID, const char* FileName, const char* Password);

Parameters

FileNameThe path and file name of the file to load.
PasswordThe password to open the file

For Predictor values 10 through 15, PNG prediction in Flate and LZW streams reads the algorithm tag on every row, compressed cross-reference streams included

Return values

0The file could not be read or processed. Use the LastErrorCode function to determine the cause of the failure.
1The file was loaded successfully

Remarks

PDF MAC-protected input is authenticated after password verification and before document pages are exposed

Imported form boundaries

Form-field enumeration visits each indirect field once and bounds traversal to depth 256 and 100000 visits; repeated or over-limit branches are omitted from the in-memory field list, and inherited field-property lookup has the same depth bound

Successful loading does not certify form-tree conformance; use the Enterprise PDF/A preflight when field hierarchy diagnostics are required