Apply Codabar Checksum Validation with Aspose.BarCode for .NET 17.03

Share on FacebookTweet about this on TwitterShare on LinkedIn

We are pleased to announce the release of Aspose.Barcode for .NET 17.03. The major development in this release is the support to apply checksum validation on Codabar coded barcode. Functionality to get barcode text along with checksum value in a single call has also been incorporated in this release.

Applying Checksum Validation On Codabar

Aspose.BarCode for .NET allows developers to apply checksum validation on Codabar. The API now exposes the CodabarChecksumMode enumeration to specify the checksum mode. EnableChecksum property of the BarCodeBuilder class is needed to be set to TRUE before setting the checksum mode. This is as illustrated in the following code sample.


// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ManageBarCodes();

//Generation
//Instantiate BarCodeBuilder object
Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();

//Set the Code text for the barcode
builder.CodeText = "1234567890";

//Set the symbology type to Code128
builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Codabar;

//Set the EnableChecksum property to yes
builder.EnableChecksum = Aspose.BarCode.EnableChecksum.Yes;

//Set the CodabarChecksumMode
builder.CodabarChecksumMode = Aspose.BarCode.CodabarChecksumMode.Mod10;

//Save the image on the system
builder.Save("Codabar_Mod10.png");

//Recognition
//Initialize reader object
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("Codabar_Mod10.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Codabar))
{
    //Set ChecksumValidation property of the reader to On
    reader.ChecksumValidation = Aspose.BarCode.BarCodeRecognition.ChecksumValidation.On;
    while (reader.Read())
    {
        //Get code text
        Console.WriteLine("{0}:{1}", reader.GetCodeType(), reader.GetCodeText());

        //Get checksum value
        Console.WriteLine("Checksum:" + reader.GetCheckSum());
    }
}

Get Barcode With Checksum Value

Aspose.BarCode for .NET allows developers to get barcode text along with checksum value. Aspose.BarCode API now exposes an overload method GetCodeText of the BarCodeReader class to accomplish the task. This is as illustrated in the following code sample.


//Initialize reader object
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("error5.jpg", Aspose.BarCode.BarCodeRecognition.DecodeType.EAN13))
{
    while (reader.Read())
    {
        //Get code text by passing TRUE to get the Barcode along with checksum value
        Console.WriteLine("{0}: {1}", reader.GetCodeType(), reader.GetCodeText(true));
    }
}

Enhancements

This month’s release also includes several bug fixes that were reported by our users in the previous release. Details about these fixes and improvements are listed below.

  • Process of reading GS1DataMatrix barcode has been improved.
  • Process of reading Code39Standard barcode has been improved.
  • Recognition process of DutchKIX barcode in MaxBarCodes mode has been improved.
  • Processing of GS1DataMatrix barcode generation has been improved.

To view a complete list of new features and fixes, please visit the release notes page. You can download the latest version by visiting the Aspose.Barcode for .NET 17.03 page in downloads section.

Aspose.BarCode for .NET Resources

The resources, you may need to accomplish your tasks: