CompareWith
Diagnostics
Requires the Small Business edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibSmallBusiness (unit PDFlibSmallBusiness) or TPDFlibEnterprise; the Small Business and Enterprise DLL and ActiveX builds provide it unchanged; the Single edition keeps the method, which returns 0, an empty string or False and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
Description
Structurally compares the selected document against a saved revision
Syntax
Delphi
Function CompareWith(Const OldFileName, OldPassword: WideString): Integer; Virtual;ActiveX
Function PDFlib::CompareWith(OldFileName As String, OldPassword As String) As LongDLL
int DLCompareWith(int InstanceID, const wchar_t* OldFileName, const wchar_t* OldPassword);
int DLCompareWithA(int InstanceID, const char* OldFileName, const char* OldPassword);Parameters
| OldFileName | Path of the saved revision loaded as the old side of the comparison |
|---|---|
| OldPassword | Password for OldFileName, or an empty string when it is not encrypted |
Return values
| 0 | No document is selected, the file does not exist or could not be loaded with the given password |
|---|---|
| N | Number 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", "");