function BuildPdfPreflightReport(Pdf: TPdf): TPdfPreflightReport; overload;
function BuildPdfPreflightReport(Pdf: TPdf; Standards: TPdfPreflightStandards): TPdfPreflightReport; overload;
function PdfPreflightIssueSeverity(Standard: TPdfPreflightStandard; const Code, Category: string): TPdfPreflightSeverity;
function PdfPreflightSeverityName(Severity: TPdfPreflightSeverity): string;
function PdfPreflightStandardName(Standard: TPdfPreflightStandard): string;
function PdfPreflightStatusName(Status: TPdfPreflightStatus): string;
function CreateDefaultPdfValidationRuleRegistry: TPdfValidationRuleRegistry;
function ValidatePdfFilesParallel(const FileNames: array of string; Registry: TPdfValidationRuleRegistry; const Options: TPdfBatchValidationOptions): TPdfBatchValidationReport;
| Type | Description |
|---|---|
TPdfPreflightStandard | Standard selector with ppsPdfA, ppsPdfUa, ppsPdfE, ppsPdfX, ppsPdfR and ppsPdfVT |
TPdfPreflightStandards | Set type used by BuildPdfPreflightReport; AllPdfPreflightStandards selects every supported standard |
TPdfPreflightStatus | Per-standard status: pfsPass, pfsActionRequired or pfsReview |
TPdfPreflightSeverity | Issue severity with psevInfo, psevWarning or psevError; TPdfPreflightSeverities is the matching filter set |
TPdfPreflightIssue | Issue row with StandardName, issue code, category, severity, description and Recommendation, plus MatchesText case-insensitive search and a StableKey identity |
TPdfPreflightIssueCategoryCount | Aggregated issue-category row returned by IssueCategoryCounts |
TPdfPreflightSeverityCount | Aggregated severity row returned by SeverityCounts with Severity, SeverityName and Count |
TPdfPreflightIssueCodeCount | Aggregated standard and issue-code row returned by IssueCodeCounts with StandardName, Code and Count |
TPdfPreflightStandardResult | One standard result with StandardName, ConformanceName, IsCompliant, StatusName, Priority, NextAction, the Issues array, ErrorCount and WarningCount severity counters, HighestSeverity, IssueCount, and the HasIssueCode issue-code lookup |
TPdfPreflightReport | Complete report with the SourceFile name, GeneratedAt timestamp, ScopeNote, the Results array of standard results, the ActionRequiredStandardCount, CompliantStandardCount, NonCompliantStandardCount, PassedStandardCount, ReviewStandardCount, StandardCount, HighestSeverity and TotalIssueCount summary counters, the FilterByStandards, FilterByCategory, FilterBySeverities, SearchIssues, FlattenIssues, HasIssueCode, FindStandard, Fingerprint, IssueCategoryCounts, IssueCodeCounts and SeverityCounts query helpers, and the ToCsv, ToHtml, ToMarkdown, ToJson, ToNdjson, ToSarif, ToJUnitXml, ToText and ToXml export helpers with matching SaveXxxToFile procedures |
TPdfValidationRule | Declarative profile clause with its Id and Profile, Clause, severity, DependencyIds, FixHint repair guidance, IssueCode, and an issue, standard, or custom Predicate chosen by PredicateKind |
TPdfValidationBudget | Limits selected rules (MaxRules), reported failures (MaxIssues), visited objects (MaxObjects), recursion (MaxRecursionDepth), evidence bytes (MaxEvidenceBytes), reserved memory (MaxMemoryBytes), and elapsed time (TimeoutMilliseconds) |
TPdfValidationOptions | Selects Profiles and Severities, supplies the Budget, enables FastFail, and supports cooperative cancellation through CancellationToken |
TPdfValidationExecutionContext | Bounded execution context handed to custom predicates; Create stores the options and starts the run clock, Checkpoint, ConsumeEvidence, ConsumeObjects, EnterRecursion, LeaveRecursion, ReserveMemory, and ReleaseMemory enforce the budget, and BudgetExceeded, BudgetReason, EvidenceBytes, ObjectsVisited, RecursionDepth, ReservedMemory, PeakReservedMemory, and StartTick expose live counters |
TPdfValidationRuleRegistry | Thread-safe rule registry; Create and Destroy manage the critical section, RegisterRule and Clear mutate the registered set, Count and Snapshot read it under lock, and Execute validates a report with per-clause evidence and timing |
TPdfBatchValidationOptions | Controls the WorkerCount, standards, nested ValidationOptions, document-level FailFast, and cancellation through CancellationToken |
TPdfBatchValidationReport | Input-ordered per-document results with aggregate issue distributions, ElapsedMilliseconds, terminal status, and the WorkerCount, PassedDocumentCount, FailedDocumentCount, CancelledDocumentCount and ErrorDocumentCount totals |
TPdfARepairPlan | Dependency-ordered remediation Steps classified by category, safety, rewrite need, signature impact and blocking state, with DocumentHasSignatures, AllowSignatureInvalidation, BlockedStepCount, AutomaticStepCount and ManualStepCount rollups, the IsExecutable readiness flag, and ToJson JSON output |
TPdfARepairCategory | Classifies repair work as parcSecurity, parcFonts, parcColour, parcAttachments, parcStructure, parcMetadata or parcOther work |
TPdfARepairSafety | parsAutomatic, parsReviewRequired or parsManual |
TPdfARepairStep | One ordered repair action with its Order, category, IssueCode, action, Evidence, dependency, and Safety, plus RequiresFullRewrite, InvalidatesSignatures, and Blocked |
TPdfXProductionPreflightOptions | Controls the MinimumImageDpi threshold, TreatTransparencyAsErrorBeforePdfX4 and IncludeInformationalColourants reporting |
TPdfXProductionPreflightReport | PDF/X Validation result plus the per-page Pages facts, HasOutputIntent, HasEmbeddedFonts, HasTransparency, HasOverprint, SeparationCount, DeviceNCount, MinimumEffectiveDpi, the Issues array, ErrorCount, the IsProductionReady verdict, and ToJson JSON output |
TPdfXProductionIssueKind | Classifies pxpikOutputIntent, pxpikPageBox, pxpikFont, pxpikColourant, pxpikTransparency, pxpikOverprint, pxpikSeparation, and pxpikImageResolution issues |
TPdfXProductionIssue | One focused production finding with its Kind, severity, PageNumber, ObjectIndex and Evidence |
TPdfXProductionPage | Per-page facts for PageNumber, HasMediaBox, HasTrimBox, HasBleedBox, HasArtBox, TextObjectCount, PathObjectCount, ImageCount, HasTransparency and MinimumEffectiveDpi |
TPdfValidationPredicateKind | Selects pvpkIssueAbsent, pvpkStandardPass or pvpkCustom rule evaluation |
TPdfValidationRuleStatus | pvrrsPass, pvrrsFail, pvrrsSkipped or pvrrsError |
TPdfValidationRunStatus | Reports pvrsComplete, pvrsFastFailed, pvrsBudgetExceeded, pvrsCancelled or pvrsError |
TPdfValidationRuleResult | Per-rule result with RuleId, Profile, Clause, status, Evidence, FixHint repair guidance and ElapsedMilliseconds |
TPdfValidationRun | One bounded registry execution with the Results array, PassedRuleCount, FailedRuleCount, SkippedRuleCount, and ErrorRuleCount counters, ObjectsVisited, EvidenceBytes, PeakReservedMemory, ElapsedMilliseconds, IncompleteReason, and compliance helpers |
TPdfPreflightIssues, TPdfPreflightStandardResults | Dynamic arrays holding issue rows and per-standard results |
TPdfPreflightIssueCategoryCounts, TPdfPreflightSeverityCounts, TPdfPreflightIssueCodeCounts | Dynamic arrays returned by the category, severity and stable issue-code aggregators |
TPdfARepairSteps | Dependency-ordered PDF/A repair steps stored by TPdfARepairPlan |
TPdfXProductionPages, TPdfXProductionIssues | Per-page production facts and focused PDF/X production issues |
TPdfValidationProfiles, TPdfValidationRules, TPdfValidationRuleResults | Selected profile names, registered declarative rules, and per-rule execution results |
TPdfValidationRulePredicate | Custom rule callback that evaluates a report through a bounded execution context and returns diagnostic evidence |
TPdfBatchValidationItemStatus | Per-document pbvisPending, pbvisPass, pbvisFail, pbvisCancelled or pbvisError state |
TPdfBatchValidationStatus | Whole-batch pbvsComplete, pbvsPartial, pbvsCancelled or pbvsFailed state |
TPdfBatchValidationItem | One input file with its Preflight report, the rule Validation result, status, ErrorMessage text, and ElapsedMilliseconds |
TPdfBatchValidationItems | Input-ordered per-document results returned by parallel validation |
BuildPdfPreflightReport calls ValidatePdfA, ValidatePdfUa, ValidatePdfE, ValidatePdfX, ValidatePdfR and ValidatePdfVT for an active TPdf document and returns a TPdfPreflightReport
The report contains one row per selected standard, detected conformance, status, priority, next action, issue code, category, Info / Warning / Error severity, description, and recommendation. Status, severity, category and issue-code counters expose reusable summary data
FindStandard, HasIssueCode, FlattenIssues, SearchIssues, FilterByStandards, FilterBySeverities and FilterByCategory provide in-memory query views. Filtered reports preserve original conformance and status values whilst returning independent issue arrays
Fingerprint returns a lowercase SHA-256 identity for the ordered standard and issue result set. Source paths and generation timestamps are intentionally excluded so equivalent validation results share one fingerprint
Each To* export has a matching Save*ToFile method. Files are written directly as UTF-8; CSV retains a BOM for Excel detection and neutralises formula-leading cells
TPdfValidationRuleRegistry executes declarative profile clauses outside the monolithic standard validators. Rules can depend on earlier clauses, select a built-in issue or profile predicate, or provide a custom predicate that records bounded evidence
TPdfValidationExecutionContext provides cooperative checkpoints and explicit counters for objects, recursion, UTF-8 evidence and reserved memory. A run reports fast-fail, cancellation, or budget exhaustion as an incomplete status rather than a complete compliance result
ValidatePdfFilesParallel gives each worker a private TPdf document, preserves input order, aggregates issue-code counts and records pass, fail, cancellation or load errors independently for every file
PDFium is not thread-safe across documents, so the workers open and inspect files one at a time under a shared lock and run only the rule evaluation in parallel; a larger WorkerCount therefore speeds up rule-heavy registries rather than document loading
BuildPdfARepairPlan maps PDF/A evidence into security, font, colour, attachment, structure, metadata and residual steps in dependency order. Signature-invalidating steps are blocked unless the caller supplies explicit authorisation
BuildPdfXProductionPreflight combines the PDF/X profile result with native page and image facts, structural colourant and overprint scans and page-box checks. It never decodes or copies image payloads during resolution analysis
| Format | Shape |
|---|---|
| Text | Plain-text source, generated time, scope note, summary, standard rows, action plan, issue categories, and issue details |
| HTML | Standalone HTML report with status styling, an issue-category table, standard table and issue table |
| Markdown | Markdown headings and tables for standards, issue categories, action plan and issue details |
| JSON | Structured object with format, sourceKind, summary, issueCategoryCounts and per-standard issue arrays |
| CSV | Spreadsheet-friendly rows identified by RowType: Summary, Standard, Category and Issue |
| SARIF 2.1.0 | CI and code-scanning results with stable rule IDs, severity levels, remediation messages, properties and partial fingerprints |
| JUnit XML | One test case per selected standard, with Action required results emitted as failures and Review results emitted as skipped cases |
| NDJSON | One summary, standard, or issue JSON object per line for incremental ingestion without loading one large JSON document |
| XML | Native preflight XML with report metadata, summary attributes, standard results, severity, descriptions and recommendations |
ValidatePdf* methodsDemo\Delphi\PreflightReport, Demo\Lazarus\PreflightReport and Demo\CBuilder\PreflightReport demonstrate standard selection, status / priority summary rows, issue-category counts in generated reports, text / Markdown / JSON / CSV preview switching, and TXT / HTML / Markdown / JSON / CSV export. The Delphi GUI sample also includes an Action Plan preview that focuses the same data into a remediation checklistDemo\Delphi\PreflightReportCli demonstrates the same report path in a scriptable console workflow. Single-file mode accepts input, output, optional password, report format, standards=, attach=, and failon=. The plan / actionplan format writes a text remediation checklist for single-file and batch runs. With no arguments, it creates a sample PDF beside the executable and writes a text reportbatch=, skips blank lines and # comments, and resolves missing relative paths from the list file's folder. Directory mode scans batchdir= for *.pdf files, optionally recurses, and sorts discovered paths before processingoutdir= routes batch reports into a shared folder. If multiple inputs resolve to the same report path, later files receive -2, -3 and later suffixes instead of overwriting earlier reportssummary=batch.txt, summary=batch.json and summary=batch.html include run settings, aggregate file totals, standard status totals, and one row per input. summary=batch.csv is a row-oriented manifest that repeats run settings on each input row and includes per-file status countsattach=output.pdf is single-file only. It embeds the generated report as a document-level attachment in a different PDF path and never writes back to the input filefailon=issues matches any reported issue, failon=action matches any Action required row, and failon=review matches Action required or Review rows. The CLI exits 0 on success, 1 on runtime errors or 2 when a selected failon= rule matches after reports are written
uses FPdfPreflightReport;
var
Report: TPdfPreflightReport;
begin
Pdf1.FileName := 'C:\Incoming\job.pdf';
Pdf1.Active := True;
Report := BuildPdfPreflightReport(Pdf1, [ppsPdfA, ppsPdfX]);
Memo1.Lines.Text := Report.ToText;
Report.SaveHtmlToFile('C:\Incoming\job.preflight.html');
Report.SaveMarkdownToFile('C:\Incoming\job.preflight.md');
Report.SaveJsonToFile('C:\Incoming\job.preflight.json');
Report.SaveCsvToFile('C:\Incoming\job.preflight.csv');
Report.SaveSarifToFile('C:\Incoming\job.preflight.sarif');
Report.SaveJUnitXmlToFile('C:\Incoming\job.preflight.junit.xml');
Report.SaveNdjsonToFile('C:\Incoming\job.preflight.ndjson');
Report.SaveXmlToFile('C:\Incoming\job.preflight.xml');
end;