PDFium Delphi Component Docs

FPdfPreflightReport unit

Unit: FPdfPreflightReport
Builds a reusable, queryable report object from the built-in PDF standards validators and exports text, HTML, Markdown, JSON, CSV, SARIF 2.1.0, JUnit XML, NDJSON or native XML

Syntax

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;

Public Types

TypeDescription
TPdfPreflightStandardStandard selector with ppsPdfA, ppsPdfUa, ppsPdfE, ppsPdfX, ppsPdfR and ppsPdfVT
TPdfPreflightStandardsSet type used by BuildPdfPreflightReport; AllPdfPreflightStandards selects every supported standard
TPdfPreflightStatusPer-standard status: pfsPass, pfsActionRequired or pfsReview
TPdfPreflightSeverityIssue severity with psevInfo, psevWarning or psevError; TPdfPreflightSeverities is the matching filter set
TPdfPreflightIssueIssue row with StandardName, issue code, category, severity, description and Recommendation, plus MatchesText case-insensitive search and a StableKey identity
TPdfPreflightIssueCategoryCountAggregated issue-category row returned by IssueCategoryCounts
TPdfPreflightSeverityCountAggregated severity row returned by SeverityCounts with Severity, SeverityName and Count
TPdfPreflightIssueCodeCountAggregated standard and issue-code row returned by IssueCodeCounts with StandardName, Code and Count
TPdfPreflightStandardResultOne 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
TPdfPreflightReportComplete 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
TPdfValidationRuleDeclarative profile clause with its Id and Profile, Clause, severity, DependencyIds, FixHint repair guidance, IssueCode, and an issue, standard, or custom Predicate chosen by PredicateKind
TPdfValidationBudgetLimits selected rules (MaxRules), reported failures (MaxIssues), visited objects (MaxObjects), recursion (MaxRecursionDepth), evidence bytes (MaxEvidenceBytes), reserved memory (MaxMemoryBytes), and elapsed time (TimeoutMilliseconds)
TPdfValidationOptionsSelects Profiles and Severities, supplies the Budget, enables FastFail, and supports cooperative cancellation through CancellationToken
TPdfValidationExecutionContextBounded 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
TPdfValidationRuleRegistryThread-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
TPdfBatchValidationOptionsControls the WorkerCount, standards, nested ValidationOptions, document-level FailFast, and cancellation through CancellationToken
TPdfBatchValidationReportInput-ordered per-document results with aggregate issue distributions, ElapsedMilliseconds, terminal status, and the WorkerCount, PassedDocumentCount, FailedDocumentCount, CancelledDocumentCount and ErrorDocumentCount totals
TPdfARepairPlanDependency-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
TPdfARepairCategoryClassifies repair work as parcSecurity, parcFonts, parcColour, parcAttachments, parcStructure, parcMetadata or parcOther work
TPdfARepairSafetyparsAutomatic, parsReviewRequired or parsManual
TPdfARepairStepOne ordered repair action with its Order, category, IssueCode, action, Evidence, dependency, and Safety, plus RequiresFullRewrite, InvalidatesSignatures, and Blocked
TPdfXProductionPreflightOptionsControls the MinimumImageDpi threshold, TreatTransparencyAsErrorBeforePdfX4 and IncludeInformationalColourants reporting
TPdfXProductionPreflightReportPDF/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
TPdfXProductionIssueKindClassifies pxpikOutputIntent, pxpikPageBox, pxpikFont, pxpikColourant, pxpikTransparency, pxpikOverprint, pxpikSeparation, and pxpikImageResolution issues
TPdfXProductionIssueOne focused production finding with its Kind, severity, PageNumber, ObjectIndex and Evidence
TPdfXProductionPagePer-page facts for PageNumber, HasMediaBox, HasTrimBox, HasBleedBox, HasArtBox, TextObjectCount, PathObjectCount, ImageCount, HasTransparency and MinimumEffectiveDpi
TPdfValidationPredicateKindSelects pvpkIssueAbsent, pvpkStandardPass or pvpkCustom rule evaluation
TPdfValidationRuleStatuspvrrsPass, pvrrsFail, pvrrsSkipped or pvrrsError
TPdfValidationRunStatusReports pvrsComplete, pvrsFastFailed, pvrsBudgetExceeded, pvrsCancelled or pvrsError
TPdfValidationRuleResultPer-rule result with RuleId, Profile, Clause, status, Evidence, FixHint repair guidance and ElapsedMilliseconds
TPdfValidationRunOne bounded registry execution with the Results array, PassedRuleCount, FailedRuleCount, SkippedRuleCount, and ErrorRuleCount counters, ObjectsVisited, EvidenceBytes, PeakReservedMemory, ElapsedMilliseconds, IncompleteReason, and compliance helpers
TPdfPreflightIssues, TPdfPreflightStandardResultsDynamic arrays holding issue rows and per-standard results
TPdfPreflightIssueCategoryCounts, TPdfPreflightSeverityCounts, TPdfPreflightIssueCodeCountsDynamic arrays returned by the category, severity and stable issue-code aggregators
TPdfARepairStepsDependency-ordered PDF/A repair steps stored by TPdfARepairPlan
TPdfXProductionPages, TPdfXProductionIssuesPer-page production facts and focused PDF/X production issues
TPdfValidationProfiles, TPdfValidationRules, TPdfValidationRuleResultsSelected profile names, registered declarative rules, and per-rule execution results
TPdfValidationRulePredicateCustom rule callback that evaluates a report through a bounded execution context and returns diagnostic evidence
TPdfBatchValidationItemStatusPer-document pbvisPending, pbvisPass, pbvisFail, pbvisCancelled or pbvisError state
TPdfBatchValidationStatusWhole-batch pbvsComplete, pbvsPartial, pbvsCancelled or pbvsFailed state
TPdfBatchValidationItemOne input file with its Preflight report, the rule Validation result, status, ErrorMessage text, and ElapsedMilliseconds
TPdfBatchValidationItemsInput-ordered per-document results returned by parallel validation

Description

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

Output Formats

FormatShape
TextPlain-text source, generated time, scope note, summary, standard rows, action plan, issue categories, and issue details
HTMLStandalone HTML report with status styling, an issue-category table, standard table and issue table
MarkdownMarkdown headings and tables for standards, issue categories, action plan and issue details
JSONStructured object with format, sourceKind, summary, issueCategoryCounts and per-standard issue arrays
CSVSpreadsheet-friendly rows identified by RowType: Summary, Standard, Category and Issue
SARIF 2.1.0CI and code-scanning results with stable rule IDs, severity levels, remediation messages, properties and partial fingerprints
JUnit XMLOne test case per selected standard, with Action required results emitted as failures and Review results emitted as skipped cases
NDJSONOne summary, standard, or issue JSON object per line for incremental ingestion without loading one large JSON document
XMLNative preflight XML with report metadata, summary attributes, standard results, severity, descriptions and recommendations

Remarks

Example

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;

See Also

ValidatePdfA, ValidatePdfX