CreatePreflightReportEx
Compliance, Document inspection
Description
Creates a preflight report for an external PDF file and converts the report to the requested output format. This is the format-aware companion to CreatePreflightReport, which always returns the plain-text report.
Syntax
Delphi
function TPDFlib.CreatePreflightReportEx(const InputFileName, Password: WideString; ComplianceTests, Options, ReportFormat: Integer): WideString;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 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. |
| ReportFormat | Output format selector. 0 — plain text. 1 — JSON object with header fields, per-check sections, issue arrays, and summary fields. 2 — standalone HTML document containing the escaped text report. 3 — CSV rows with metadata, selected checks, issue codes and messages, and final summary rows. |
Return value
Returns the generated report in the selected format. Unknown ReportFormat values fall back to the plain-text format.
Remarks
The JSON, HTML, and CSV formats are generated from the same text report used by CreatePreflightReport, so pass/fail status and issue counts stay consistent across all report formats.
The JSON object exposes header fields, a sections array, issue-string arrays, and a summary object. The HTML form is a standalone document that escapes the text report inside a preformatted block. The CSV form uses fixed kind,section,status,code,message columns and separates metadata, check status, issue rows, and summary rows for spreadsheet or CI parsing.
For the full report-format contract and demo command-line examples, see Preflight Reports.
Example
JsonReport := PDF.CreatePreflightReportEx('output.pdf', '', 1 or 2, 0, 1);
HtmlReport := PDF.CreatePreflightReportEx('output.pdf', '', 1 or 2, 0, 2);
CsvReport := PDF.CreatePreflightReportEx('output.pdf', '', 1 or 2, 0, 3);See also
Preflight Reports, CreatePreflightReport, SavePreflightReportEx, ComparePreflightReports, CheckFileCompliance