Ability to Find Out Minimum Height And Width For A Barcode Image With Aspose.BarCode for .NET 17.7

Aspose.Barcode for .NET We are pleased to announce the release of Aspose.Barcode for .NET 17.7. The major development in this release is the support to get minimum barcode image size. Improved functionality of GetOnlyBarCodeImage method has also been incorporated in this release.

Get Minimum BarCode Size

Aspose.BarCode now supports the functionality to get the minimum height & width required for a barcode image. How a developer can get the minimum size (height & width) required for a barcode image 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 barcode text
// Set encoding type
using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("1234567890", Aspose.BarCode.Generation.EncodeTypes.Code128))
{
    // Set graphic unit
    builder.GraphicsUnit = System.Drawing.GraphicsUnit.Pixel;

    // Call GetMinimumBarCodeSize method to get the minimum size required
    System.Drawing.SizeF minSize = builder.GetMinimumBarCodeSize();

    // Set Auto size to false
    builder.AutoSize = false;

    // Set image height & width with the help of min size got from GetMinimumBarCodeSize method
    builder.ImageWidth = minSize.Width;
    builder.ImageHeight = minSize.Height;

    // Save the barcode image
    using (System.Drawing.Bitmap image = builder.BarCodeImage)
        image.Save("minimumresult.png");
}

Enhancements

This month’s release also includes enhancements. Details about the enhancements are listed below.

  • Functionality of GetOnlyBarCodeImage method has been improved. The working of GetOnlyBarCodeImage method with small size has been enhanced.

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.7 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