CreateTextComparisonReport
Small Business, comparison reports
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 an empty string and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
Requires Small Business or Enterprise; a plain TPDFlib returns an empty string with error 901
Description
Compares the selected document against a separately loaded baseline file and returns the extracted-text comparison as an HTML or JSON report, leaving the selected document in place
Syntax
Delphi
Function TPDFlib.CreateTextComparisonReport(Const OtherFileName, Password: WideString; Granularity, ReportFormat: Integer): WideString; Virtual;ActiveX
Function PDFlib::CreateTextComparisonReport(OtherFileName As String, Password As String, Granularity As Long, ReportFormat As Long) As StringDLL
const wchar_t* DLCreateTextComparisonReport(int InstanceID, const wchar_t* OtherFileName, const wchar_t* Password, int Granularity, int ReportFormat);
const char* DLCreateTextComparisonReportA(int InstanceID, const char* OtherFileName, const char* Password, int Granularity, int ReportFormat);Parameters
| OtherFileName | Path of the baseline PDF loaded separately for comparison; the selected document is retained |
|---|---|
| Password | Password for the baseline file, or an empty string when it is not encrypted |
| Granularity | 0 compares words; 1 compares lines |
| ReportFormat | 0 produces an HTML report; 1 produces a JSON envelope |
Return values
Returns the comparison report in the requested format. The selected document is not replaced, and a valid comparison report sets LastErrorCode to 0 even when differences or an incomplete comparison are present. The Single edition returns an empty string with error 901, and operational failures return an error report with error 905.
Compares the selected document with a separately loaded baseline file without replacing the selected document; Granularity is 0 for words or 1 for lines, and ReportFormat is 0 for HTML or 1 for JSON
The HTML report presents escaped baseline and current text in parallel columns; it cannot execute markup found in document text
The JSON envelope contains schemaVersion:1, status, comparisonKind:"extracted-text", complete and the underlying comparison object
Incomplete comparison remains visible in both formats; these reports compare extracted text, without comparing page appearance, image content or layout
Operational errors return an error report and set error 905; a valid comparison report sets error 0 even when it contains differences or incomplete comparison
Report:= PDF.CreateTextComparisonReport('baseline.pdf', '', 0, 0);
DLL and Dylib provide DLCreateTextComparisonReport and its A variant; ActiveX uses IPDFlibrary8 or CoPDFlibrary.CreateEditionTools8
SaveTextComparisonPDF · CompareTextBaselineBatch · CompareDocumentTextsWith