This short tutorial describes how to generate data matrix barcode using Java. All the necessary details are provided, such as a list of steps for writing the application, reference to the required library, and sample code for developing a datamatrix maker in Java. Various customization options will be discussed to generate the data matrix code according to the requirements.
Steps for Data Matrix Code Generator using Java
- Set the IDE to use Aspose.BarCode for Java to develop a data matrix generator
- Import the required module from the library to generate a data matrix code
- Instantiate the barcode generator with the desired text and encoding type
- Set the encoding mode to automatic for the data matrix
- To make the resultant code reliable, set the error correction level to ECC 200
- Define the size of each module cell in the output barcode
- Set the image resolution to the desired value
- Save the generated data matrix barcode as an image on the disk
These steps explain the process for creating a datamatrix code generator using Java. Commence the process by creating a BarcodeGenerator class object with the sample text to encode and encoding type DATA_MATRIX, and save the image as barcode. Optionally, you may customize the output image by accessing the barcode parameters and set the encoding mode, error correction level, module size in the barcode and the image resolution.
Code for Data Matrix Generator using Java
This sample code assists in developing a data matrix QR code generator using Java. Set the aspect ratio for controlling the height/width proportion of each module cell, set the rotation angle for controlling the orientation, and set the caption above or below the encoded symbol to make the QR code readable. You may also add a border for a framed appearance and set the background color instead of relying on the default white.
This article guides you on creating a 2D barcode. To set the barcode checksum, refer to the article Set Barcode Checksum using Java.