bardecode.com
barcode reading software
  • Home
  • Download
  • Purchase
  • SDK Licensing
  • Pricing
    • Windows SDK Price List
    • Windows SDK with PDF Extension Price List
    • PDF Extension For Windows Price List
    • Linux SDK Price List
    • Multi-Platform Toolkit for .Net/Docker Price List
    • BardecodeFiler Desktop Only Price List
    • BardecodeFiler Windows Service Price List
    • DOS Command Prompt Barcode Tool Price List
  • Products
    • Barcode Reader Toolkit for Windows
    • Barcode Reader Toolkit for Linux
    • BardecodeFiler Application Desktop Only
    • BardecodeFiler Application & Windows Service
    • Windows DOS Command Prompt Barcode Tool
    • Multi-Platform Barcode Reader Toolkit for .Net Standard on Docker
    • Aquaforest’s Autobahn DX
  • Knowledge Base
    • Documentation
    • Specifications
  • News
  • Contact
    • About Us
    • Resellers
    • Links
Select Page ...

News

Using the SoftekBarcode DLL with Python

admin October 16, 2014 Blog, Knowledge Base, News, Software Development Kits

The following code as been kindly contributed by a developer to show how to use the SoftekBarcode DLL interface with Python:


Python 3.7:

import ctypes
from ctypes import *
import os

# Load the dll
softekDLL = ctypes.OleDLL("C:\\tmp\\SoftekBarcodedll.dll")

# Create Barcode Instance and Set License Key
barCode1 = softekDLL.mtCreateBarcodeInstance()

# Set the license key
softekDLL.mtSetLicenseKey(barCode1, 'your license key'.encode('utf-8'))

# Scan some file
n = softekDLL.mtScanBarCode(barCode1,'\\path\\to\\some\\file.jpg'.encode('utf-8'))

# print the barcode
print (ctypes.c_char_p(softekDLL.mtGetBarString(barCode1,1)).value)

Python 2.7:

import ctypes
from ctypes import *
import os

# Set up the path to SoftekBarcode.dll
softek = r’C:\\Your\\Path\\To\\softek_barcode_sdk\\x86′
os.environ[‘PATH’] = ‘;’.join([softek, os.environ[‘PATH’]])
softekDLL = ctypes.OleDLL(os.path.join(softek, ‘SoftekBarcode.dll’))

# Create Barcode Instance and Set License Key
barCode1 = softekDLL.mtCreateBarcodeInstance()
softekDLL.mtSetLicenseKey(barCode1,’Your License Key’)

# Configure Scanner for DataMatrix w/Skew
softekDLL.mtSetReadDataMatrix(barCode1,True)
softekDLL.mtSetSkewedDatamatrix(barCode1,True)
softekDLL.mtSetSkewTolerance(barCode1,1)

# Scan a code and report on the findings
# c_char_p() effectively casts the result to a char string
n = softekDLL.mtScanBarCode(barCode1,’C:\\Your\\Path\\To\\DSCN3724.JPG’)
print “%s %s Found” % (n,c_char_p(softekDLL.mtGetBarStringType(barCode1,1)).value)
print c_char_p(softekDLL.mtGetBarString(barCode1,1)).value

← Linux SDK gets support for Centos 6 and Ubuntu 12.10
iOS 64-bit support →
admin

  • Copyright © 2021 Softek Software Ltd. All Rights Reserved