ComparePreflightReportsA

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)

Compliance, Document inspection

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to ComparePreflightReports and string arguments are interpreted using the current SetAnsiMode code page

Compares two plain-text preflight reports and returns a compact line-by-line diff when their stable content differs. Use this API to detect report drift in regression tests, CI jobs, or delivery checks that keep a baseline report next to a PDF fixture

Syntax

Delphi

Function DLComparePreflightReportsA(InstanceID: Integer; ReportA: PAnsiChar; ReportB: PAnsiChar): PAnsiChar;

DLL

const char* DLComparePreflightReportsA(int InstanceID, const char* ReportA, const char* ReportB);

Parameters

ReportABaseline plain-text report, usually produced by CreatePreflightReport or read back from a file created by SavePreflightReport
ReportBCurrent plain-text report to compare with the baseline

Return values

Returns an empty string when the reports match after normalizing volatile Generated: timestamp lines. When stable content differs, the result starts with PDF Library for Delphi Preflight Report Diff; shared lines use a two-space prefix, lines only in ReportA use - , and lines only in ReportB use +

Remarks

The comparison is designed for the deterministic text output produced by CreatePreflightReport. It does not parse JSON, HTML, or CSV reports; compare the plain-text form when a workflow needs stable regression gates and then generate any formatted report needed for humans or downstream tools. See Preflight Reports for the full command-line and batch workflow

Example

Baseline := TFile.ReadAllText('expected-preflight.txt', TEncoding.UTF8);
Current := PDF.CreatePreflightReport('output.pdf', '', 1 or 2, 0);
Diff := PDF.ComparePreflightReports(Baseline, Current);
if Diff <> '' then
  TFile.WriteAllText('preflight.diff.txt', Diff, TEncoding.UTF8);

See also

Preflight Reports, CreatePreflightReport, CreatePreflightReportEx, SavePreflightReport, SavePreflightReportEx, CheckFileCompliance