Aspose.Barcode for Python via Java Generation and Recognition API docs
asposebarcode.Recognition.ChecksumValidation Class Reference

Enable checksum validation during recognition for 1D barcodes. More...

Inherits Enum.

Static Public Attributes

int DEFAULT = 0
 
int ON = 1
 
int OFF = 2
 

Detailed Description

Enable checksum validation during recognition for 1D barcodes.

Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.

Checksum never used: Codabar

Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN

Checksum always used: Rest symbologies

This sample shows influence of ChecksumValidation on recognition quality and results

generator = BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128")
generator.save("test.png")
reader = BarCodeReader("test.png", DecodeType.EAN_13)
#checksum disabled
reader.setChecksumValidation(ChecksumValidation.OFF)
for result in reader.readBarCodes():
print("BarCode CodeText: " + result.getCodeText())
print("BarCode Value: " + result.getExtended().getOneD().getValue())
print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())
reader = BarCodeReader("test.png", DecodeType.EAN_13)
#checksum enabled
reader.setChecksumValidation(ChecksumValidation.ON)
for result in reader.readBarCodes():
print("BarCode CodeText: " + result.getCodeText())
print("BarCode Value: " + result.getExtended().getOneD().getValue())
print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())

Member Data Documentation

◆ DEFAULT

int asposebarcode.Recognition.ChecksumValidation.DEFAULT = 0
static

◆ OFF

int asposebarcode.Recognition.ChecksumValidation.OFF = 2
static

◆ ON

int asposebarcode.Recognition.ChecksumValidation.ON = 1
static