Identify Type of Code128 Barcode And Generate Barcode Having A Logo/Image/Picture Inside The Barcode Image Instead of Codetext with Aspose.BarCode for .NET 17.6

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Aspose.Barcode for .NET 17.5 We are pleased to announce the release of Aspose.Barcode for .NET 17.6. The major development in this release is the support to generate the QR barcode with a logo/image inside the barcode image. Functionality to identify the type of Code128 coded barcode while performing barcode recognition has also been incorporated in this release.

Create Barcode with Image In Place of Codetext

Aspose.BarCode now supports generating barcode with logo/other image inside it instead of codetext. How a developer can embed a logo/image/picture inside the barcode is very simple and is demonstrated in the code snippet given below. The code snippet contains comments that makes it self explanatory.


// Create an instance of BarCodeBuilder class
// Set the barcode text
// Set the barcode symbology 
using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("123456789012", Aspose.BarCode.Generation.EncodeTypes.EAN13))
{
    // Generate Barcode image and store it in a Bitmap
    using (System.Drawing.Bitmap barcode = builder.GenerateBarCodeImage())
    {
        // Load the logo/other image as Bitmap
        using (System.Drawing.Bitmap picture = (System.Drawing.Bitmap)System.Drawing.Image.FromFile(@"path_to_your_picture.png"))
        {
            // Create a new empty image with new Calculated height & width
            using (System.Drawing.Bitmap output = new System.Drawing.Bitmap(System.Math.Max(barcode.Width, picture.Width), barcode.Height + picture.Height))
            {
                // Get the Graphics object
                using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(output))
                {
                    // Clear the canvas 
                    g.Clear(System.Drawing.Color.White);

                    // Draw the primary image (barcode image) on the canvas
                    g.DrawImage(picture, new System.Drawing.PointF(0, 0));

                    // Draw the second image (logo image) on the canvas inside the barcode image
                    g.DrawImage(barcode, new System.Drawing.PointF(0, picture.Height));
                }
                output.Save("output.jpg");
            }
        }
    }
}

Identify The Type of Code128 Coded Barcode

Aspose.BarCode for .NET provides the functionality to identify the type of Code128 barcode while performing barcode recognition operation. Following code snippet demonstrates how to achieve the functionality.


// Create an instance of BarCodeReader class
// Set file path
// Set the recognition type
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("1bc.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Code128))
{
    // Perform read operation
    if (reader.Read())
    {
        // Create an array of Code128DataPortion class
        // Call the GetCode128DataPortions method
        Aspose.BarCode.BarCodeRecognition.Code128DataPortion[] code128DataPortions = reader.GetCode128DataPortions();

        // Execute Loop for each Code128DataPortion instance
        foreach (Aspose.BarCode.BarCodeRecognition.Code128DataPortion code128DataPortion in code128DataPortions)
        {
            // Display the subtype and data
            Console.WriteLine("Code128SubType {0}", code128DataPortion.Code128SubType);
            Console.WriteLine("Data {0}", code128DataPortion.Data);
        }
    }
}

Enhancements

This month’s release also includes few bug fixes that were reported by our customers in the previous release and enhancements. Details about the fixes and enhancements are listed below.

  • Functionality to read the supplement code text from EAN13 coded barcode has been improved.
  • Recognition process was recognizing EAN13 coded barcode as UPC-A. An enhancemnet has been made in the algorithm to correctly recognizing EAN13 coded barcode.

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.6 page in downloads section.

Aspose.BarCode for .NET Resources

You can get started with Aspose.BarCode for .NET by making use of information available in the following:


To keep up with our news, you can follow us on Twitter or follow our Facebook page.

Leave a Reply