CompareDocumentVisualsWith

Document comparison, Rendering

Requires the Small Business edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibSmallBusiness (unit PDFlibSmallBusiness) or TPDFlibEnterprise; this method is Pascal-only: it takes a second library instance, which the C and Automation ABIs do not carry, so no DLL, ActiveX or Dylib build exports it; the Single edition keeps the method, which returns an empty string and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)

Description

Align and compare document page images

Syntax

Function TPDFlib.CompareDocumentVisualsWith(Other: TPDFlib; DPI: Double;
  Const Options: TPDFVisualCompareOptions): WideString; Virtual;

Parameters

OtherThe second loaded library instance; both documents keep their selected pages after the report
DPIFinite positive resolution in dots per inch used to render and fingerprint every page of both documents
OptionsTPDFVisualCompareOptions; ColorTolerance and IgnoreRects affect paired pixel comparisons, while mask and overlay requests are ignored for this document report

Return values

status=completeJSON report with both page counts, the changed, added, removed and unchanged page counts, and ordered page pairs carrying firstPage, secondPage, kind and per-pair comparison measurements
status=errorJSON report with complete=false and an error text when the input is invalid or rendering or page pairing fails; no partial success report is produced and LastErrorCode is 401

Remarks

Returns JSON with status=complete, page counts, changed/added/removed/unchanged counts, and ordered page pairs; operation failures return status=error and complete=false without a partial success report

Page pairing uses a bounded longest common subsequence of exact visible-pixel fingerprints, including image dimensions; identical pages anchor inserted and removed pages, and unmatched gaps are paired in order

Pair kinds are unchanged, changed, added, removed, and size_changed; a zero page number indicates an absent page in that input

Repeated identical pages and rewritten gaps can have ambiguous correspondence; the reported alignment describes the deterministic image-based algorithm rather than semantic page identity

Channel tolerance and ignored regions affect paired pixel comparisons; anchors use exact fingerprints before those options are applied

Both documents retain their selected pages; at most 8192 combined pages and 4M alignment matrix cells are accepted

JSON contains comparison measurements and regions, while mask and overlay requests are ignored for this document report; use CompareRenderedPagesWith for binary artifacts from a selected pair

See also

CompareRenderedPagesWith, CompareFileVisuals