CompareFileVisuals

文件比較、描繪

需要 Small Business 版本。在 Delphi、C++Builder 與 Lazarus 程式碼中,請以 TPDFlibSmallBusiness(PDFlibSmallBusiness 單元)或 TPDFlibEnterprise 建立程式庫;Small Business 與 Enterprise DLL 及 ActiveX 組建原樣提供。Single 版本保留此方法,方法會傳回 0、空字串或 False,並將 LastErrorCode 設為 901(PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)

描述

以視覺方式比較目前文件與 PDF 檔案

語法

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 String

DLL

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);

參數

OtherFileName比較用 PDF 的路徑,會載入暫時實例,並繼承此實例的轉譯器、裁剪、縮放與繪圖設定
Password比較檔案的密碼;未加密文件可用空字串。DLL 的 A 進入點會依實例的 ANSI 組態轉換它
DPI用來轉譯並為兩份文件每一頁建立指紋的有限正數解析度(每英吋點數)
ColorTolerance每個色版的容差(含端點),0 至 255

傳回值

status=complete由 CompareDocumentVisualsWith 產生的文件 JSON 報告,含頁數、對別種類與比較量測值
status=error容差超出範圍、檔案無法載入或轉譯失敗時,回傳含 complete=false 與 error 文字的 JSON 報告;容差無效時 LastErrorCode 為 401,其他情況則帶有載入錯誤

備註

載入要比較的 PDF,並傳回與 CompareDocumentVisualsWith 相同的文件 JSON 報告;ColorTolerance 必須在 0 到 255 之間,DPI 必須是有限的正數

載入的文件會繼承目前實例的描繪器、縮放、裁剪與圖形設定;目前所選的文件與頁面不受影響

輸入遺漏、選項無效、描繪失敗與密碼錯誤都會傳回 status=error 與 complete=false;DLL 呼叫遇到無效實例時傳回 null 指標

DLL 寬字串結果由實例持有,必須在下一次寬字串結果呼叫前複製;A 結果是 UTF-8 JSON,輸入檔名與密碼依實例的 ANSI 設定解碼

忽略區域與個別遮罩或覆疊輸出請使用具型別的頁面或文件 API

另請參閱

CompareRenderedPagesWith, CompareDocumentVisualsWith