CompareFileVisuals
Document comparison, Rendering
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
Compare the current document with a PDF file visually
Syntax
Delphi
Function TPDFlib.CompareFileVisuals(Const OtherFileName, Password: WideString;
DPI: Double; ColorTolerance: Integer): WideString; Virtual;ActiveX
Function PDFlib::CompareFileVisuals(OtherFileName As String, Password As String, DPI As Double, ColorTolerance As Long) As StringDLL
const wchar_t* DLCompareFileVisuals(int InstanceID, const wchar_t* OtherFileName, const wchar_t* Password, double DPI, int ColorTolerance);
const char* DLCompareFileVisualsA(int InstanceID, const char* OtherFileName, const char* Password, double DPI, int ColorTolerance);Parameters
| OtherFileName | Path to the comparison PDF, loaded into a temporary instance that inherits this instance renderer, crop, scale and graphics settings |
|---|---|
| Password | Password for the comparison file, or an empty string for an unencrypted document; the DLL A entry points convert it from the instance ANSI configuration |
| DPI | Finite positive resolution in dots per inch used to render and fingerprint every page of both documents |
| ColorTolerance | Inclusive per-channel tolerance from 0 through 255 |
Return values
| status=complete | The document JSON report produced by CompareDocumentVisualsWith, with page counts, pair kinds and comparison measurements |
|---|---|
| status=error | JSON report with complete=false and an error text when the tolerance is out of range, the file cannot be loaded or rendering fails; LastErrorCode is 401 for an invalid tolerance and carries the load error otherwise |
Remarks
Loads the comparison PDF and returns the same document JSON report as CompareDocumentVisualsWith; ColorTolerance must be from 0 to 255 and DPI must be finite and positive
The loaded document inherits the current instance renderer, scale, crop, and graphics settings; the current selected document and page are retained
Missing input, invalid options, rendering failures, and password failures return status=error and complete=false; DLL calls with an invalid instance return a null pointer
The DLL wide result is instance-owned and must be copied before another wide-result call; the A result contains UTF-8 JSON, with input filenames and passwords decoded according to the instance ANSI setting
Use the typed page or document API for ignored regions and individual mask or overlay output