We are pleased to announce the release of Aspose.Barcode for Java 17.5. The major development in this release is the support to generate the QR barcode with a logo/image inside the barcode image. This release supports to generate DataMatix barcode with C40 and Text encoding scheme. Functionality of AllSupportedTypes recognition mode has also been improved and incorporated in this release.
Create QR Barcode with Image Inside It
Aspose.BarCode now supports generating QR barcode with logo/other image inside it. How a developer can embed a logo/image/picture inside a QR barcode image is very simple and is demonstrated in the code snippet given below. The code snippet is ornate with comments that makes it self explanatory.
// Define barcode image height & width int QRCODE_IMAGE_HEIGHT = 300; int QRCODE_IMAGE_WIDTH = 300; // Create an instance of BarCodeBuilder class // Set the barcode text // Set the barcode symbology BarCodeBuilder builder = new BarCodeBuilder("123456789", com.aspose.barcode.EncodeTypes.QR); // Set the error level builder.setQRErrorLevel(com.aspose.barcode.QRErrorLevel.LevelH); // Set the Graphics Unit builder.setGraphicsUnit(2); // Generate the barocde image and save it as image in an object of BufferedImage class java.awt.image.BufferedImage image = builder.getCustomSizeBarCodeImage(QRCODE_IMAGE_WIDTH, QRCODE_IMAGE_HEIGHT, false); System.out.println("ImageHeight: " + image.getHeight()); // Load the image in an object of BufferedImage class - this is the image that you want to embed into the barcode image. java.awt.image.BufferedImage overlay = javax.imageio.ImageIO.read(new java.io.File("wifi_logo.jpg")); // Calculate the height & width int deltaHeight = image.getHeight() - overlay.getHeight(); int deltaWidth = image.getWidth() - overlay.getWidth(); // Create a new empty image java.awt.image.BufferedImage combined = new java.awt.image.BufferedImage(QRCODE_IMAGE_WIDTH, QRCODE_IMAGE_HEIGHT, java.awt.image.BufferedImage.TYPE_INT_ARGB); // Get the Graphics2D object java.awt.Graphics2D g = (java.awt.Graphics2D)combined.getGraphics(); // Draw the primary image (barcode image) on the canvas g.drawImage(image, 0, 0, null); g.setComposite(java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.SRC_OVER, 1f)); // Draw the second image (logo image) on the canvas inside the barcode image g.drawImage(overlay, (int)Math.round(deltaWidth/2), (int)Math.round(deltaHeight/2), null); // Create and save the final very of the image with barcode and logo inside it java.io.File imageFile = new java.io.File("qrcode_with_logo.png"); javax.imageio.ImageIO.write(combined, "PNG", imageFile);
Create C40 Encoded Datamatrix Barcode
Aspose.BarCode for Java provides the most convenient way to produce C40 encoded DataMatrix. How simple it is to produce a C40 encoded DataMatrix is illustrated in the following code sample.
// Create an instance of BarCodeBuilder class // Set codetext value and EncodeType com.aspose.barcode.BarCodeBuilder buidler = new com.aspose.barcode.BarCodeBuilder("ABCDEF123456", com.aspose.barcode.EncodeTypes.DATA_MATRIX); // Set the DataMatrix encoding mode to C40 buidler.setDataMatrixEncodeMode(com.aspose.barcode.DataMatrixEncodeMode.C40); // Save the barcode image buidler.save("dataMatrixC40.png");
Create Text Encoded Datamatrix Barcode
Aspose.BarCode for Java provides the functionality to generate the DataMatrix barcode with Text encoding scheme. Following code snippet demonstrates how to create DataMatrix with Text mode enabled.
// Create an instance of BarCodeBuilder class // Set codetext value and EncodeType com.aspose.barcode.BarCodeBuilder buidler = new com.aspose.barcode.BarCodeBuilder("ABCDEF123456", com.aspose.barcode.EncodeTypes.DATA_MATRIX); // Set the DataMatrix encoding mode to Text buidler.setDataMatrixEncodeMode(com.aspose.barcode.DataMatrixEncodeMode.TEXT); // Save the barcode image buidler.save("dataMatrixC40.png");
Complete list of enhancements and fixes in this release is as follows.
- Functionality of AllSupportedTypes recognition mode has been improved.
- Functionality to recognize DataMatix barcode has been improved. Recognition algorithm has been improved in much a way that it is now capable of decoding non-printable chars and decoding some special characters/symbols.
- Functionality to read barocde from PDF file has been improved.
To view a complete list of new features, fixes and to download the latest release, please visit Aspose.Barcode for Java 17.5 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:
Aspose.BarCode for Java Wiki docs – help documentation and API reference documents.
Aspose.BarCode Product Family Forum – post your technical questions and queries, or any other problem you faced while running Aspose.BarCode APIs.
Enable Email Subscription – Don’t limit yourself, you can keep yourself updated with the latest news on Aspose.BarCode APIs and new features, fixes, plus other API related topics by subscribing to Aspose.BarCode blog.
Aspose.BarCode for Java Examples – We have published our code examples on the social coding website GitHub.com. Anyone could explore the code examples for learning purposes.