Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
This section provides quick code samples to help you get started with barcode generation and recognition using Aspose.BarCode for Python via Java.
This example demonstrates how to recognize a Code 128 barcode from an image file.
license = Assist.License()
license.setLicense(pythonLicensePath)
barcodeReader = BarCodeReader(image_path,None, DecodeType.CODE_128)
barcodeReader.setQualitySettings(QualitySettings.getMaxQuality())
results = barcodeReader.readBarCodes()
for result in results:
print("Code Type:", result.getCodeTypeName())
print("Code Text:", result.getCodeText())
This example shows how to generate a QR code and save it as a PNG file.
license = Assist.License()
license.setLicense(pythonLicensePath)
generator = BarcodeGenerator(EncodeTypes.CODE_128, "123456")
image = generator.generateBarCodeImage()
generator.save(image_path, Generation.BarCodeImageFormat.PNG)
barcodeReader = BarCodeReader(image_path, None, DecodeType.CODE_128)
barcodeReader.setQualitySettings(QualitySettings.getMaxQuality())
results = barcodeReader.readBarCodes()
for result in results:
print("Code Type:", result.getCodeTypeName())
print("Code Text:", result.getCodeText())
This example demonstrates how to generate and read a complex Mailmark 2D barcode.
license = Assist.License()
license.setLicense(pythonLicensePath)
swissQRCodetext = ComplexBarcode.SwissQRCodetext(None)
swissQRCodetext.getBill().setAccount("CH450023023099999999A")
swissQRCodetext.getBill().getCreditor().setName("Name")
swissQRCodetext.getBill().getCreditor().setCountryCode("NL")
swissQRCodetext.getBill().setBillInformation("BillInformation")
complexBarcodeGenerator = ComplexBarcodeGenerator(swissQRCodetext)
file_path = os.path.join(folder, "swiss_qr_codetext.png")
complexBarcodeGenerator.save(file_path, BarCodeImageFormat.PNG)
barCodeReader = BarCodeReader(file_path, None, Recognition.DecodeType.QR)
barCodeResults = barCodeReader.readBarCodes()
for result in barCodeResults:
print("BarCode Type: " + result.getCodeTypeName())
print("BarCode CodeText: " + result.getCodeText())
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.