DetectPageBarcodesJSON
條碼辨識、文件檢查、描繪
描述
在整頁或頁面局部區域內辨識支援的一維與二維條碼,傳回含解碼內容與頁面空間幾何的確定性 JSON
語法
Delphi
Function TPDFlib.DetectPageBarcodesJSON(Page: Integer;
Left, Top, Width, Height, DPI: Double; Formats: Integer= 0;
Options: Integer= 0; MaxResults: Integer= 32): WideString;ActiveX
Function PDFlib::DetectPageBarcodesJSON(Page As Long,
Left As Double, Top As Double, Width As Double, Height As Double,
DPI As Double, Formats As Long, Options As Long,
MaxResults As Long) As StringDLL
const wchar_t* DLDetectPageBarcodesJSON(int InstanceID, int Page,
double Left, double Top, double Width, double Height, double DPI,
int Formats, int Options, int MaxResults);
const char* DLDetectPageBarcodesJSONA(int InstanceID, int Page,
double Left, double Top, double Width, double Height, double DPI,
int Formats, int Options, int MaxResults);參數
| Page | 頁碼(1 起算) |
|---|---|
| Left, Top | 區域原點,以頁面使用者空間點為單位、從左上角量起 |
| Width, Height | 區域尺寸,以頁面使用者空間點為單位;四個區域值都設為零表示掃描整頁 |
| DPI | 套用 RenderScale 之後的描繪解析度,24 到 2400;零表示選用 300 DPI |
| Formats | PDF_BARCODE_FORMAT_* 常數的遮罩;零表示 PDF_BARCODE_FORMAT_ANY |
| Options | PDF_BARCODE_TRY_HARDER、PDF_BARCODE_PURE、PDF_BARCODE_RETURN_ERRORS、PDF_BARCODE_DISABLE_ROTATE、PDF_BARCODE_DISABLE_INVERT 與 PDF_BARCODE_DISABLE_DOWNSCALE 的遮罩 |
| MaxResults | 最大結果數,1 到 255 |
傳回值
傳回 JSON 物件,包含頁面、有效 DPI、請求區域、結果數量,以及帶有 formatName、text、內容類型、符號系統識別碼、糾錯等級、方向、有效性旗標、四個頁面空間角點與邊界的結果物件
驗證、渲染、後端載入或辨識失敗時傳回空字串
備註
此方法只把請求的區域渲染到一張有大小上限的由上而下 BGR 點陣圖,並在傳回前還原先前所選的頁面
請依處理程序架構,把 PDFlibBarcode32.dll 或 PDFlibBarcode64.dll 部署在主執行檔、PDFlib DLL 或 ActiveX 模組旁;PDFLIB_BARCODE_READER 可指定替代的後端絕對路徑
LastErrorCode 為 115 表示頁面、幾何、遮罩、解析度或限制無效,519 表示渲染、後端或辨識失敗