快速入手条形码阅读器Barcode Reader Toolkit最新版v8.4.1!教你如何更新到Python接口界面

我们很高兴地告诉大家Windows条形码阅读器SDK的8.4.1近期发布上线。添加了.Net Core和Python接口,改进了读取矩形数据矩阵条形码的功能。

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

具体更新内容如下:

  • 添加了.Net Core和Python接口
  • .Net界面中的QRCodeAutoMedianFilter属性已从bool更改为short。该属性实际上是一个掩码,并且以前不应在此接口中指定为bool。
  • 改进了读取矩形数据矩阵条形码的功能。
  • 更改安装文件夹的结构,致使更容易了解哪些DLL文件构成了该工具箱的核心部分。

考虑到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 toolkita.mtCreateBarcodeInstance.restype = ctypes.c_void_phBarcode = c_void_p(a.mtCreateBarcodeInstance())

因此,我们确保hBarcode是c_void_p(正如您可能假设的是上述代码)。这意味着您可以正常使用它,而不必每次都强制转换。

整个示例Python脚本现在显示为:

import os, platformimport ctypesfrom ctypes import *# Load the correct DLL file, note the use of CDLL on 64-bit and WinDLL on 32-bitif 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 decodeinputFile = ‘file.tif’# Create an instance of the bardecode toolkita.mtCreateBarcodeInstance.restype = ctypes.c_void_phBarcode = c_void_p(a.mtCreateBarcodeInstance())# Set a license keya.mtSetLicenseKey(hBarcode, ‘YOUR LICENSE KEY’.encode(“utf-8”))# Set the ReadQRCode propertya.mtSetReadQRCode(hBarcode, True)# Scan the input file for barcodesnBarcodes = a.mtScanBarCode(hBarcode, inputFile.encode(“utf-8”))# Collect the outputfor x in range(1, nBarcodes + 1):a.mtGetBarString.restype = ctypes.c_char_pbarcodeValue = a.mtGetBarString(hBarcode, x)print (barcodeValue.decode(“utf-8”))a.mtDestroyBarcodeInstance(hBarcode)

Barcode Reader Toolkit for Windows正版授权特享在线订购专属优惠!>>点击咨询购买
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年3月1日
下一篇 2020年3月1日

相关推荐

发表回复

登录后才能评论