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, and MaxPages, with a Default class function |
| Report | TPdfDocumentDiffReport. Fields Equivalent, Truncated, LeftPageCount, RightPageCount, ComparedPageCount, DifferentPageCount, PixelDifferenceCount, and Differences; each TPdfPageDifference carries PageIndex, TextDifferent, GeometryDifferent, PixelDifferenceCount, and PixelBounds |
| Result | Boolean. True when the documents are equivalent under the selected options |
The comparison uses PDFium text extraction and rendering rather than 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 settings compare pages by position; enable AlignPages with True to recognise inserted, deleted and exactly moved pages
Alignment combines extracted text, page geometry and a 64-by-64 rendered fingerprint; repeated-page pairing is deterministic, and pages moved and modified together may be classed as modifications
PagePairs and individual differences expose zero-based LeftPageIndex and RightPageIndex, using -1 for an absent page; Kind takes dpkMatched, dpkModified, dpkMoved, dpkInserted or dpkDeleted
TextDiffMode chooses dtmNone, dtmCharacters or dtmWords; TextChanges supplies UTF-16 LeftStart, LeftLength, RightStart and RightLength while keeping surrogate pairs intact
CollectPixelRegions collects connected-tile PixelRegions with exclusive Right and Bottom edges, retaining the legacy combined PixelBounds as well
Detail work is limited by MaxAlignmentCells, MaxTextCharacters, MaxTextDiffCells, MaxTextTokens, PixelRegionTileSize, MaxPixelRegions and MaxDetailItems; DetailTruncated flags incomplete detail independently of the page-limit Truncated
Report supplies InsertedPageCount, DeletedPageCount and MovedPageCount; individual differences have their own DetailTruncated flag too
RenderDiffOverlay exports a visual overlay owned by the caller; the limited helper algorithms are exposed through FPdfDiff