CreateTextComparisonReport
Small Business、比較報告
需要 Small Business 版本。在 Delphi、C++Builder 與 Lazarus 程式碼中,請以 TPDFlibSmallBusiness(PDFlibSmallBusiness 單元)或 TPDFlibEnterprise 建立程式庫;Small Business 與 Enterprise 的 DLL 和 ActiveX 組建原樣提供。Single 版保留此方法,方法會傳回空字串,並將 LastErrorCode 設為 901(PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
需要 Small Business 或 Enterprise 版;單純的 TPDFlib 回傳空字串並設錯誤 901
描述
將所選文件與另行載入的基準檔案比較,並以 HTML 或 JSON 報告傳回擷取文字比較,所選文件維持不變
語法
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);參數
| OtherFileName | 為比較而另行載入的基準 PDF 路徑;所選文件會保留 |
|---|---|
| Password | 基準檔案的密碼;未加密時為空字串 |
| Granularity | 0 比對詞;1 比對行 |
| ReportFormat | 0 產生 HTML 報告;1 產生 JSON 封套 |
傳回值
以要求的格式傳回比較報告。所選文件不會被取代;即使有差異或比較不完整,有效的比較報告仍會將 LastErrorCode 設為 0。Single 版傳回空字串與錯誤 901,操作失敗則傳回錯誤報告與錯誤 905。
將所選文件與另行載入的基準檔案比較,但不取代所選文件;Granularity 為 0 比對詞、1 比對行,ReportFormat 為 0 輸出 HTML、1 輸出 JSON
HTML 報告以並列欄位呈現經轉義的基準文字與目前文字;它不會執行文件文字中的標記
JSON 封套包含 schemaVersion:1、status、comparisonKind:"extracted-text"、complete 與底層的 comparison 物件
比較不完整在兩種格式中都會呈現;這些報告只比較擷取文字,不比較頁面外觀、影像內容或版面
操作錯誤會傳回錯誤報告並設定錯誤 905;有效的比較報告即使含有差異或比較不完整,仍設定錯誤 0
Report:= PDF.CreateTextComparisonReport('baseline.pdf', '', 0, 0);
DLL 與 Dylib 提供 DLCreateTextComparisonReport 及其 A 變體;ActiveX 使用 IPDFlibrary8 或 CoPDFlibrary.CreateEditionTools8
SaveTextComparisonPDF · CompareTextBaselineBatch · CompareDocumentTextsWith