Ability to Get Minimum Height And Width For A Barcode Image With Aspose.BarCode for Java 17.7

Aspose.BarCode for Java We are pleased to announce the release of Aspose.Barcode for Java 17.7. The major development in this release is the support to get the minimum height & width required for a barcode image. Functionality of GetOnlyBarCodeImage method has also been improved in this release.

Find Out Minimum BarCode Height & Width

Aspose.BarCode now supports the functionality to get the minimum height & width required for a barcode image to be generated. How to know the minimum required size (height & width) for a barcode image is very simple and is demonstrated in the code snippet given below.



// Create an instance of BarCodeBuilder class
// Set barcode text
// Set encoding type
com.aspose.barcode.BarCodeBuilder builder = 
        new com.aspose.barcode.BarCodeBuilder("1234567890", com.aspose.barcode.EncodeTypes.CODE_128);

// Set graphic unit
builder.setGraphicsUnit(com.aspose.barcode.GraphicsUnit.Pixel);

// Call GetMinimumBarCodeSize method to get the minimum size required

java.awt.geom.Dimension2D minSize = builder.getMinimumBarCodeSize();

// Set Auto size to false
builder.setAutoSize(false);

// Set image height & width with the help of min size got from GetMinimumBarCodeSize method
builder.setImageWidth((float) minSize.getWidth());
builder.setImageHeight((float)minSize.getHeight());

// Save the barcode image
javax.imageio.ImageIO.write( builder.getBarCodeImage(), "PNG", new java.io.File("minimumresult.png") );

Enhancements

Complete list of enhancements in this release is as follows.

  • Functionality to print barcode has been improved. The working has been enhanced in such a way that barcode lines are now smooth when printing the barcode on a label printer.
  • 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, fixes and to download the latest release, please visit Aspose.Barcode for Java 17.7 page in downloads section.

Aspose.BarCode for Java Resources

The following API resources can be of help to you in getting started with Aspose.BarCode:


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

Leave a Reply