ApplyOCRTextLayerA

OCR、文字、文件編輯

描述

ApplyOCRTextLayer 的 ANSI 版本

字串參數接受 ANSI 文字,其餘行為與寬字元字串版本完全相同

語法

Delphi

Function TPDFlib.ApplyOCRTextLayer(Page: Integer; Const ResultJSON,
  FontName: WideString; MinConfidence: Double): Integer;

ActiveX

Function PDFlib::ApplyOCRTextLayer(Page As Long, ResultJSON As String, FontName As String, MinConfidence As Double) As Long

DLL

int DLApplyOCRTextLayer(int InstanceID, int Page, const wchar_t* ResultJSON,
  const wchar_t* FontName, double MinConfidence);
int DLApplyOCRTextLayerA(int InstanceID, int Page, const char* ResultJSON,
  const char* FontName, double MinConfidence);

傳回值

1文字圖層已加入,或沒有單字達到閾值
0驗證或寫入失敗

備註

頁面內容寫入前會驗證完整 JSON 結構與每個文字邊界

每個文字以其方框高度決定大小,並以文字縮放做水平調整,同時以隔離的圖形狀態防止 OCR 格式外洩到後續的繪圖操作

LastErrorCode 為 110 表示 OCR JSON 無效,307 表示頁面、字型或文字層寫入失敗

LastOCRError 提供詳細原因

另請參閱

OCRPage, OCRDocument, LastOCRError, RenderPageToString