BarcodeSettings.ChecksumValidation
Contents
[
Hide
]BarcodeSettings.ChecksumValidation property
Enable checksum validation during recognition for 1D and Postal barcodes.
Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.
Checksum never used: Codabar, PatchCode, Pharmacode, DataLogic2of5
Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, ItalianPost25, Matrix2of5, MSI, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN
Checksum always used: Rest symbologies
public ChecksumValidation ChecksumValidation { get; set; }
Property Value
Enable checksum validation during recognition for 1D and Postal barcodes.
Examples
This sample shows influence of ChecksumValidation on recognition quality and results
[C#]
using (BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.EAN13, "1234567890128"))
{
generator.Save(@"c:\test.png");
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.EAN13))
{
//checksum disabled
reader.BarcodeSettings.ChecksumValidation = ChecksumValidation.Off;
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode CodeText: " + result.CodeText);
Console.WriteLine("BarCode Value: " + result.Extended.OneD.Value);
Console.WriteLine("BarCode Checksum: " + result.Extended.OneD.CheckSum);
}
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.EAN13))
{
//checksum enabled
reader.BarcodeSettings.ChecksumValidation = ChecksumValidation.On;
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode CodeText: " + result.CodeText);
Console.WriteLine("BarCode Value: " + result.Extended.OneD.Value);
Console.WriteLine("BarCode Checksum: " + result.Extended.OneD.CheckSum);
}
}
[VB.NET]
Using generator As New BarcodeGenerator(EncodeTypes.EAN13, "1234567890128")
generator.Save("c:\test.png")
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.EAN13)
'checksum disabled
reader.BarcodeSettings.ChecksumValidation = ChecksumValidation.Off
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Console.WriteLine("BarCode Value: " + result.Extended.OneD.Value)
Console.WriteLine("BarCode Checksum: " + result.Extended.OneD.CheckSum)
Next
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.EAN13)
'checksum enabled
reader.BarcodeSettings.ChecksumValidation = ChecksumValidation.On
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Console.WriteLine("BarCode Value: " + result.Extended.OneD.Value)
Console.WriteLine("BarCode Checksum: " + result.Extended.OneD.CheckSum)
Next
End Using
See Also
- enum ChecksumValidation
- class BarcodeSettings
- namespace Aspose.BarCode.BarCodeRecognition
- assembly Aspose.BarCode