Technisch artikel

PDFium: PreflightReportCli batch validation in Delphi

Integreer PDFium VCL Component-workflows in Delphi- en C++Builder-toepassingen, of PDFium LCL Component-workflows in Lazarus/FPC, met broncodecomponenten voor weergave, rendering, formulieren, afdrukken, preflight-rapporten en standaardgerichte validatie.

Dit artikel is bedoeld voor teams integrating command-line PDF validation into build, intake, archive, or customer-processing pipelines. Het behandelt PreflightReportCli batch validation als productiegerichte documentengineering, niet als een losse componentaanroep.

Het praktische risico is dat batch validation is only useful if exit codes, timeouts, report paths, severity thresholds, and retry behavior are stable enough for automation. Daarom heeft de workflow een geschreven contract, observeerbare diagnose en representatieve regressiebestanden nodig.

Architectuurbeslissingen

Design the CLI as a contract for automation. profile selection, fail-on severity, report format, and output directory layout / exit-code mapping for pass, warning, failure, timeout, bad input, and internal error

  • profile selection, fail-on severity, report format, and output directory layout
  • exit-code mapping for pass, warning, failure, timeout, bad input, and internal error
  • parallelism, maximum file size, quarantine path, and retry rules
  • how structured reports are retained with tickets, builds, or customer jobs

Implementatiepad

Map validation findings to process outcomes. The order below keeps the workflow reviewable for Delphi and C++Builder teams.

  1. standardize command-line arguments before wiring the tool into schedulers
  2. run one file per isolated job so timeouts and failures do not poison the batch
  3. write human and machine reports to deterministic locations
  4. translate findings into pass, review, block, or quarantine states
  5. summarize the batch with counts by severity, profile, and outcome

Validatiebewijs

Batch evidence that makes failures actionable. Keep these fields with the output or support record.

  • command arguments, profile version, file count, elapsed time, and exit code
  • per-file report path, status, issue count, highest severity, and failure reason
  • timeout, retry, quarantine, and cleanup actions
  • machine-readable summary attached to the automated job record

Exit codes should reflect business policy

A preflight CLI is a bridge between PDF analysis and automation. It should produce predictable reports for people, structured output for machines, and clear exit behavior for schedulers and CI systems.

Regression files worth keeping

Keep more than successful samples. A useful PreflightReportCli batch validation regression set contains normal files, boundary files, and intentional failure files so the behavior is stable across releases.

  • one corrupt file should not prevent reports for all remaining files
  • warnings may need to fail CI but only flag intake jobs for manual review
  • parallel processing should not write reports with colliding names
  • operators need a stable difference between validation failure and tool failure
  • standardize command-line arguments before wiring the tool into schedulers
  • run one file per isolated job so timeouts and failures do not poison the batch

Engineering review notes for PreflightReportCli batch validation

Use these review notes to make sure the feature has moved beyond a demo and can be defended during release, support, and customer escalation.

  • Decision: profile selection, fail-on severity, report format, and output directory layout. Implementation pressure point: run one file per isolated job so timeouts and failures do not poison the batch. Acceptance evidence: timeout, retry, quarantine, and cleanup actions. Regression trigger: operators need a stable difference between validation failure and tool failure
  • Decision: exit-code mapping for pass, warning, failure, timeout, bad input, and internal error. Implementation pressure point: write human and machine reports to deterministic locations. Acceptance evidence: machine-readable summary attached to the automated job record. Regression trigger: one corrupt file should not prevent reports for all remaining files
  • Decision: parallelism, maximum file size, quarantine path, and retry rules. Implementation pressure point: translate findings into pass, review, block, or quarantine states. Acceptance evidence: command arguments, profile version, file count, elapsed time, and exit code. Regression trigger: warnings may need to fail CI but only flag intake jobs for manual review
  • Decision: how structured reports are retained with tickets, builds, or customer jobs. Implementation pressure point: summarize the batch with counts by severity, profile, and outcome. Acceptance evidence: per-file report path, status, issue count, highest severity, and failure reason. Regression trigger: parallel processing should not write reports with colliding names
  • Decision: profile selection, fail-on severity, report format, and output directory layout. Implementation pressure point: standardize command-line arguments before wiring the tool into schedulers. Acceptance evidence: timeout, retry, quarantine, and cleanup actions. Regression trigger: operators need a stable difference between validation failure and tool failure
  • Decision: exit-code mapping for pass, warning, failure, timeout, bad input, and internal error. Implementation pressure point: run one file per isolated job so timeouts and failures do not poison the batch. Acceptance evidence: machine-readable summary attached to the automated job record. Regression trigger: one corrupt file should not prevent reports for all remaining files

Randgevallen

  • one corrupt file should not prevent reports for all remaining files
  • warnings may need to fail CI but only flag intake jobs for manual review
  • parallel processing should not write reports with colliding names
  • operators need a stable difference between validation failure and tool failure

Delphi / C++Builder notes

PDFium Component should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. Important terms include PreflightReportCli, batch validation, exit code, severity, report path, timeout.

Delphi-codevoorbeeld

De volgende Delphi-schets toont een praktische servicegrens voor dit onderwerp. Houd beleidscontroles, logging en validatie buiten het smalle productaanroepblok, zodat de workflow testbaar blijft.

procedure RunPdfiumBatch(const Files: TArray<string>; const OutputDir: string);
var
  FileName: string;
begin
  for FileName in Files do
  begin
    PdfView.LoadFromFile(FileName);
    WritePreflightJson(OutputDir, FileName, InspectDocument(PdfView));
    PdfView.Close;
  end;
  WriteBatchSummary(OutputDir);
end;

Productiechecklist

  • Run the workflow on an empty file, a normal customer file, and a worst-case file
  • Open the generated PDF with the target viewer, validator, printer, or downstream application
  • Log product version, profile version, input hash, output path, elapsed time, and warning count
  • Keep passwords, certificates, temporary files, and customer data under explicit retention rules
  • Add regression documents when a customer file exposes a new edge case

Product documentation

PDFium Component