CreateValidationReport

Compliance

Описание

Строит структурированный отчёт валидации PDF/A и PDF/UA-1 в XML или JSON, с пунктом ISO и статистикой при каждой находке

Синтаксис

Delphi

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

Параметры

InputFileNameПроверяемый PDF-файл
PasswordПароль для открытия файла либо пустая строка
ComplianceTestsБитовая маска выбираемых проверок: 1 = PDF/A, 2 = PDF/UA-1, 0 = обе
OptionsПробрасывается в проверки: 1 останавливает каждую на первой находке
ReportFormat0 = XML, 1 = JSON.

Return values

Empty stringВходного файла не существует
ReportПолный документ отчёта

Примечания

При выборе нескольких стандартов файл разбирается один раз, и обе проверки используют общий reader, состояние защиты, граф объектов документа и кэш ленивых объектов

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.

Пример

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

См. также

CreateValidationPipelineReport, SaveValidationReport, CheckFileCompliance, CreatePreflightReport, CreatePreflightReportEx