SavePreflightReport
Compliance, Document inspection
Requires the Enterprise edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibEnterprise (unit PDFlibEnterprise); the Enterprise DLL and ActiveX builds provide it unchanged; other editions keep the method, which returns 0, an empty string or False and sets LastErrorCode to 900 (PDFLIB_ERROR_ENTERPRISE_REQUIRED)
Description
Creates a plain-text preflight report with CreatePreflightReport and writes it to a UTF-8 text file. The output directory is created automatically when it does not already exist
Syntax
Delphi
Function TPDFlib.SavePreflightReport(Const InputFileName, Password, ReportFileName: WideString; ComplianceTests, Options: Integer): Integer; Virtual;ActiveX
Function PDFlib::SavePreflightReport(InputFileName As String, Password As String, ReportFileName As String, ComplianceTests As Long, Options As Long) As LongDLL
int DLSavePreflightReport(int InstanceID, const wchar_t* InputFileName, const wchar_t* Password, const wchar_t* ReportFileName, int ComplianceTests, int Options);
int DLSavePreflightReportA(int InstanceID, const char* InputFileName, const char* Password, const char* ReportFileName, int ComplianceTests, int Options);
Parameters
| InputFileName | Full path of the PDF file to validate |
|---|---|
| Password | Password used to open the file. Pass an empty string for unencrypted documents |
| ReportFileName | Destination text-report path. Parent directories are created automatically. Passing an empty value returns 0 |
| ComplianceTests | Bit mask selecting which checks to include: 1 for PDF/A, 2 for PDF/UA-1, 3 or 0 for both |
| Options | Bit flags passed through to each selected compliance check. Pass 1 to stop each check after its first issue |
Return values
| 0 | The report file name was empty |
|---|---|
| 1 | The report was generated and written successfully |
Remarks
Use SavePreflightReportEx when the output should be JSON, HTML, or CSV. File-open, validation, or write errors are surfaced as exceptions from the underlying file and compliance-check paths. Wrap the call when using it in command-line tools or services that need process-level exit codes
Example
if PDF.SavePreflightReport('output.pdf', '', 'output-preflight.txt', 1 or 2, 0) = 1 then
WriteLn('Preflight report saved.');See also
Preflight Reports, SavePreflightReportEx, CreatePreflightReport, ComparePreflightReports, CheckFileCompliance, ReleaseStringList