CreatePreflightReport
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)
PDF/UA reader profile selection
PDF/UA checks select part 2 when XMP identifies pdfuaid:part=2 and otherwise retain the part 1 checks; legacy PDF/UA-1 checks described here are not implied to apply to part 2
The PDF/UA-2 profile implements core identification, namespace, role and structure checks; structured reports use PDF/UA-2 and ISO 14289-2 and disclose fullCertification=false and unverified scope
Use CheckFilePDFUACompliance or RunPDFUAValidationPipelineTask to force a target part and GetPDFUAReadValidationCoverageJSON to inspect capability limits
Description
Creates a plain-text preflight report for an external PDF file by running the existing PDF/A and PDF/UA-1 file-compliance checks and formatting their results into one reusable report body. This is the convenience API to use when an application wants a human-readable report instead of manually calling CheckFileCompliance, GetStringListCount, GetStringListItem, and ReleaseStringList
Syntax
Delphi
Function TPDFlib.CreatePreflightReport(Const InputFileName, Password: WideString; ComplianceTests, Options: Integer): WideString; Virtual;ActiveX
Function PDFlib::CreatePreflightReport(InputFileName As String, Password As String, ComplianceTests As Long, Options As Long) As StringDLL
const wchar_t* DLCreatePreflightReport(int InstanceID, const wchar_t* InputFileName, const wchar_t* Password, int ComplianceTests, int Options);
const char* DLCreatePreflightReportA(int InstanceID, const char* InputFileName, const char* Password, int ComplianceTests, int Options);
Parameters
| InputFileName | Full path of the PDF file to validate. The file is opened read-only and is not modified |
|---|---|
| Password | Password used to open the file. Pass an empty string for unencrypted documents |
| ComplianceTests | Bit mask selecting which checks to include. 1 — PDF/A. 2 — PDF/UA-1. 3 — both PDF/A and PDF/UA-1. Passing 0 also runs both checks |
| Options | Bit flags passed through to each underlying compliance check. 0 — Report every issue found in each selected check. 1 — Stop each selected check after the first issue |
Return values
Returns a UTF-16 text report containing the report header, one section per selected compliance check, and a final summary with Total issues and Result lines
Remarks
When multiple standards are selected, the file is parsed once and both audits share the same reader, security state, document object graph, and lazy object cache
The report API does not replace a dedicated external PDF/A validator. It packages the library's built-in first-line PDF/A and PDF/UA-1 diagnostics into a stable application-facing report. Use CreatePreflightReportEx when the application needs text, JSON, HTML, or CSV output, and use CheckFileCompliance directly when it needs individual issue-list handles instead of formatted text
The plain-text report is the canonical source for every formatted report. It contains volatile Generated: metadata, an Input: path, the selected checks, the issue collection mode, one section for each selected compliance test, and a final summary with Total issues and Result
For command-line and batch-report workflows, see Preflight Reports
Example
var
Report: WideString;
begin
Report := PDF.CreatePreflightReport('output.pdf', '', 1 or 2, 0);
WriteLn(Report);
end;See also
Preflight Reports, CreatePreflightReportEx, SavePreflightReport, ComparePreflightReports, CheckFileCompliance, GetPDFUADiagnostics, SetPDFAMode, SetPDFUAMode