Barcode Xpress for Linux provides a sample Python application which uses the ctypes module to interface with the shared library. You can use this sample as an example of how to interact with the library on your own, or you can drop the BarcodeXpress.py file from that sample into your application.
BarcodeXpress.py exports five relevant methods:
Analyzing a barcode has two steps:
- Make appropriate licensing calls as needed.
- Call one of the analyze functions, passing in needed parameters.
import BarcodeXpress
# The SetSolutionName and SetSolutionKey methods must be called to distribute the runtime.
BarcodeXpress.SetSolutionName("YourSolutionName")
BarcodeXpress.SetSolutionKey(12345, 12345, 12345, 12345)
# SetOEMLicenseKey is required if Manually Reported Runtime Licensing is used.
#BarcodeXpress.SetOEMLicenseKey("2.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation...")
# AnalyzeFile takes an image path, an optional dictionary of options, and returns a list of barcodes found in the image.
results = BarcodeXpress.AnalyzeFile("./path/to/your/image.bmp", {
"BarcodeTypes": \[BarcodeXpress.BarcodeType.All\]
})
for i in range(0, len(results)):
print("Result #" + str(i + 1))
print("\\tType: " + results\[i\].Name)
print("\\tValue: " + results\[i\].Value)