function CompareWith(Other: TPdf; const Options: TPdfDocumentDiffOptions; out Report: TPdfDocumentDiffReport): Boolean;
| Other | TPdf. The other active document |
| Options | TPdfDocumentDiffOptions. Fields RenderWidth, RenderHeight, ColorTolerance, CompareText, ComparePageGeometry, MaxPages, AlignPages, TextDiffMode, CollectPixelRegions, MaxAlignmentCells, MaxTextCharacters, MaxTextDiffCells, MaxTextTokens, PixelRegionTileSize, MaxPixelRegions, MaxDetailItems, and SimilarityOptions, with a Default class function |
| Report | TPdfDocumentDiffReport. Fields Equivalent, Truncated, LeftPageCount, RightPageCount, ComparedPageCount, DifferentPageCount, PixelDifferenceCount, Differences, PagePairs, InsertedPageCount, DeletedPageCount, MovedPageCount, and DetailTruncated; each TPdfPageDifference carries PageIndex, LeftPageIndex, RightPageIndex, Kind, TextDifferent, GeometryDifferent, PixelDifferenceCount, PixelBounds, TextChanges, PixelRegions, and DetailTruncated |
| Result | Boolean. True when the documents are equivalent under the selected options |
The comparison uses PDFium text extraction and rendering instead of interpreting content streams in parallel
Geometry includes page dimensions and rotation; visual comparison applies the caller colour tolerance per channel and reports the changed pixel bounds
MaxPages bounds work for untrusted or very large documents, and Truncated reports when the comparison stopped at that limit
The current page of both documents is restored before the method returns
Legacy Default options compare corresponding page positions; set AlignPages to True to identify insertions, deletions and exact page moves
Alignment uses extracted text, page geometry and a 64-by-64 render fingerprint; duplicate exact pairing is deterministic
PagePairs and each difference expose zero-based LeftPageIndex and RightPageIndex, with -1 for a missing page; Kind is dpkMatched, dpkModified, dpkMoved, dpkInserted, dpkDeleted or dpkMovedModified
SimilarityOptions is a TPdfDiffAlignmentOptions record initialized by Default; with AlignPages enabled, set SimilarityOptions.MatchSimilarPages to True to identify confident text-similar pages that moved and changed together
Matching requires equal page geometry and unique mutual candidates; PagePairs[].Similarity reports a 0..1000 evidence score and SimilarityAmbiguous exposes unresolved candidates before positional gap fallback
dpkMovedModified increments MovedPageCount and retains text/pixel details; the overlay uses the move color for both kinds of movement; blank, image-only, short and low-information pages are outside the similarity profile
Similarity character/comparison budgets are explicit, and exhaustion raises an exception while restoring both active page positions; see FPdfDiff for scoring, thresholds and limits
TextDiffMode selects dtmNone, dtmCharacters or dtmWords; TextChanges reports UTF-16 LeftStart, LeftLength, RightStart and RightLength without splitting surrogate pairs
CollectPixelRegions adds connected tile PixelRegions with exclusive Right and Bottom bounds while preserving the legacy PixelBounds union
MaxAlignmentCells, MaxTextCharacters, MaxTextDiffCells, MaxTextTokens, PixelRegionTileSize, MaxPixelRegions and MaxDetailItems bound detail work; DetailTruncated indicates incomplete detail independently of page-limit Truncated
The report includes InsertedPageCount, DeletedPageCount and MovedPageCount; each difference also carries its own DetailTruncated
RenderDiffOverlay exports a caller-owned visual overlay; FPdfDiff exposes the bounded helper algorithms