SaveTextComparisonPDF
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 0 and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
Requires Small Business or Enterprise
Description
Compares the selected document against a separately loaded baseline file and writes the extracted-text differences to a paginated A4 review PDF, leaving the selected document in place
Syntax
Delphi
Function TPDFlib.SaveTextComparisonPDF(Const OtherFileName, Password: WideString; Granularity: Integer; Const OutputFileName: WideString): Integer; Virtual;ActiveX
Function PDFlib::SaveTextComparisonPDF(OtherFileName As String, Password As String, Granularity As Long, OutputFileName As String) As LongDLL
int DLSaveTextComparisonPDF(int InstanceID, const wchar_t* OtherFileName, const wchar_t* Password, int Granularity, const wchar_t* OutputFileName);
int DLSaveTextComparisonPDFA(int InstanceID, const char* OtherFileName, const char* Password, int Granularity, const char* OutputFileName);Parameters
| OtherFileName | Path of the baseline PDF loaded separately for comparison |
|---|---|
| Password | Password for the baseline file, or an empty string when it is not encrypted |
| Granularity | 0 compares words; 1 compares lines |
| OutputFileName | New local .pdf path for the separate paginated A4 review report; the selected source document is retained |
Return values
| 1 | The review PDF was written to OutputFileName |
|---|---|
| 0 | Nothing was written; LastErrorCode is 905 for an operational failure, 901 when the instance lacks the Small Business edition, or the report exceeds 2048 pages or no suitable font is available |
For source-page difference rectangles, use SaveVisualComparisonPDF
Writes a separate, paginated A4 review PDF containing baseline and current text changes, page references, contrasting text colours and an explicit completeness statement; the selected source document is retained
Granularity is 0 for words or 1 for lines; this is an extracted-text review report, without pixel overlays or source-page difference rectangles
The writer requires embeddable Arial and Arial Bold or DejaVu Sans and DejaVu Sans Bold; automatic fallback handles available supplementary fonts; missing suitable fonts or more than 2048 report pages causes failure
Returns 1 on success or 0 with error 905 on operational failure; Single returns 0 with error 901; a saved report can itself describe incomplete comparison
PDF.SaveTextComparisonPDF('baseline.pdf', '', 1, 'review.pdf');
DLL and Dylib provide DLSaveTextComparisonPDF and its A variant; ActiveX exposes the method through IPDFlibrary8