CompareWith

Diagnostics

Description

Structurally compares the selected document against a saved revision

Syntax

Delphi

Function CompareWith(Const OldFileName, OldPassword: WideString): Integer;

Return values

0No document is selected, the file does not exist or could not be loaded with the given password
NNumber of findings; read them with the GetCompareFinding accessors

Remarks

Loads OldFileName as the old side and walks both documents, fingerprinting every indirect object from a canonical form in which indirect references collapse to markers so renumbered-but-identical objects still match. Pass one aligns objects by fingerprint; pass two pairs the remaining unmatched objects by number and reports them as changed, and anything still unpaired is added (new side) or removed (old side). Page-count differences are reported before object findings. The findings stay available until the next CompareWith call.

Example

N:= PDF.CompareWith("invoice_v1.pdf", "");

See also

AuditObjectReachability, GetDocumentJSON