原創|產品更新|編輯:李顯亮|2020-04-01 10:21:26.127|閱讀 341 次
概述:我們很高興地告訴大家Windows條形碼閱讀器SDK的8.4.1近期發布上線。添加了.Net Core和Python接口,改進了讀取矩形數據矩陣條形碼的功能。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Barcode Reader Toolkit for Windows 是一個工具包,允許開發人員在其應用程序中添加條形碼檢測。該工具包將圖像文件或內存位圖作為輸入,并返回有關每個條形碼的信息,包括值,類型和位置。所有主要的線性(1-D)條形碼(例如代碼39)和2-D條形碼(例如DataMatrix,PDF-417和QR-Code)都作為標準支持在工具包中。
我們很高興地告訴大家Windows條形碼閱讀器SDK的8.4.1近期發布上線。添加了.Net Core和Python接口,改進了讀取矩形數據矩陣條形碼的功能。
>>免費下載最新版Barcode Reader Toolkit for Windows
具體更新內容如下:
考慮到Python 3和Windows 64位,我們對Windows上連接Python的推薦方式進行了一些更改。
第一個更改是在DLL文件本身的加載中。
if platform.machine().endswith(’64’): bardecodeLibrary = os.getcwd() + ‘../../../SoftekBarcode64DLL.dll’ a=CDLL(bardecodeLibrary) else: bardecodeLibrary = os.getcwd() + ‘../../../SoftekBarcodeDLL.dll’ a=WinDLL(bardecodeLibrary)
第二個重要更改節省了以后的重復。
# Create an instance of the bardecode toolkit a.mtCreateBarcodeInstance.restype = ctypes.c_void_p hBarcode = c_void_p(a.mtCreateBarcodeInstance())
因此,我們確保hBarcode是c_void_p(正如您可能假設的是上述代碼)。這意味著您可以正常使用它,而不必每次都強制轉換。
整個示例Python腳本現在顯示為:
import os, platform import ctypes from ctypes import * # Load the correct DLL file, note the use of CDLL on 64-bit and WinDLL on 32-bit if platform.machine().endswith(’64’): bardecodeLibrary = os.getcwd() + ‘../../../SoftekBarcode64DLL.dll’ a=CDLL(bardecodeLibrary) else: bardecodeLibrary = os.getcwd() + ‘../../../SoftekBarcodeDLL.dll’ a=WinDLL(bardecodeLibrary) # Set the name of the image to decode inputFile = ‘file.tif’ # Create an instance of the bardecode toolkit a.mtCreateBarcodeInstance.restype = ctypes.c_void_p hBarcode = c_void_p(a.mtCreateBarcodeInstance()) # Set a license key a.mtSetLicenseKey(hBarcode, ‘YOUR LICENSE KEY’.encode(“utf-8”)) # Set the ReadQRCode property a.mtSetReadQRCode(hBarcode, True) # Scan the input file for barcodes nBarcodes = a.mtScanBarCode(hBarcode, inputFile.encode(“utf-8”)) # Collect the output for x in range(1, nBarcodes + 1): a.mtGetBarString.restype = ctypes.c_char_p barcodeValue = a.mtGetBarString(hBarcode, x) print (barcodeValue.decode(“utf-8”)) a.mtDestroyBarcodeInstance(hBarcode)
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn