CreateValidationReport
Compliance
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
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; Virtual;ActiveX
Function PDFlib::CreateValidationReport(InputFileName As String, Password As String, ComplianceTests As Long, Options As Long, ReportFormat As Long) As StringDLL
const wchar_t* DLCreateValidationReport(int InstanceID, const wchar_t* InputFileName, const wchar_t* Password, int ComplianceTests, int Options, int ReportFormat);
const char* DLCreateValidationReportA(int InstanceID, const char* InputFileName, const char* Password, int ComplianceTests, int Options, int ReportFormat);Parameters
| InputFileName | The PDF file to validate |
|---|---|
| Password | The password required to open the file, or an empty string |
| ComplianceTests | Bit mask selecting the checks: 1 = PDF/A, 2 = PDF/UA-1, 0 = both |
| Options | Passed through to the checks; 1 stops at the first finding of each check |
| ReportFormat | 0 = XML, 1 = JSON |
Return values
| Empty string | The input file does not exist |
|---|---|
| Report | The 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 emitted occurrences. 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
Incomplete checks
A check with only incomplete findings (00130 or 00132) returns result: incomplete; the overall summary is also incomplete unless another check fails, and incompleteChecks counts such checks separately from failedChecks and passedChecks
Findings 00130 and 00132 have warning severity and JSON incomplete: true; they identify an unsupported, unreadable or bounded-out signature or color audit rather than a proven conformance failure
A failure takes precedence over incompleteness, which takes precedence over a pass; a standard that was not requested stays not-checked, and applications should accept only a passed summary for the selected checks
Legacy preflight text and prose-derived formats retain their finding-based failure summary; the raw structured validation report carries the explicit incomplete state
Example
// Uses System.JSON
Report:= PDF.CreateValidationReport('invoice.pdf', '', 3, 0, 1);
Root:= TJSONObject.ParseJSONValue(string(Report)) as TJSONObject;
try
if Root = nil then
raise Exception.Create('The validation report is not JSON');
Verdict:= Root.GetValue<TJSONObject>('summary').GetValue<string>('result');
if Verdict <> 'passed' then
ShowMessage('The selected checks failed or could not be completed');
finally
Root.Free;
end;See also
CreateValidationPipelineReport, SaveValidationReport, CheckFileCompliance, CreatePreflightReport, CreatePreflightReportEx