CreateValidationReport

Compliance

Description

Builds a structured PDF/A and PDF/UA-1 validation report in XML or JSON, with the ISO clause and statistics attached to every finding.

Syntax

Delphi

Function TPDFlib.CreateValidationReport(Const InputFileName, Password: WideString; ComplianceTests, Options, ReportFormat: Integer): WideString;

Parameters

InputFileNameThe PDF file to validate.
PasswordThe password required to open the file, or an empty string.
ComplianceTestsBit mask selecting the checks: 1 = PDF/A, 2 = PDF/UA-1, 0 = both.
OptionsPassed through to the checks; 1 stops at the first finding of each check.
ReportFormat0 = XML, 1 = JSON.

Return values

Empty stringThe input file does not exist.
ReportThe complete report document.

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

Each finding carries the rule id, the standard that owns the rule (ISO 19005-1 or ISO 14289-1), a short machine-readable rule name, the ISO clause the rule enforces, a severity and the number of affected objects. Every check element closes with its own result and issue count, and the report ends with a summary carrying the document verdict, the total issue count and the number of passed and failed checks.

A standard that was not requested is reported as not-checked rather than as a passing check, so a run that covered only one standard cannot be mistaken for a clean bill of health.

This differs from CreatePreflightReportEx, which renders a human report first and then converts that prose into JSON, HTML or CSV. The validation report is assembled from the raw check output, so a build pipeline can gate on a rule id or an ISO clause instead of matching substrings in a sentence.

Example

Report:= PDF.CreateValidationReport('invoice.pdf', '', 0, 0, 1);
if Pos('"result": "failed"', Report)> 0 then
  ShowMessage('the file did not pass validation');

See also

CreateValidationPipelineReport, SaveValidationReport, CheckFileCompliance, CreatePreflightReport, CreatePreflightReportEx