Data matrix code is an omnidirectional 2D barcode defined by an L-shaped pattern at one side of the code along with solid border at two adjacent sides. In specific use cases, you may need to create a Data Matrix code with a variety of encoding types. This article explains how to generate a Data Matrix Code programmatically in Java.
- Java API Installation to Generate Data Matrix Code
- Generate Data Matrix Code in Java
- Generate Data Matrix ECC200 Code in Java
Java API Installation to Generate Data Matrix Code
You can easily configure Aspose.BarCode for Java API that supports, creating or scanning several kinds of barcodes. You may download the reference JAR files and the javadoc file with the following configurations in the pom.xml file to access it from Aspose Repository.
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>http://repository.aspose.com/repo/</url> </repository>
<dependency> <groupId>com.aspose</groupId> <artifactId>aspose-barcode</artifactId> <version>22.8</version> </dependency>
Generate Data Matrix Code in Java
You can generate a Data Matrix Code with the following steps:
- Create a BarcodeGenerator class object while specifying the EncodeType.
- Set the encoding mode for the Data Matrix code.
- Generate the Data Matrix code and save the output file.
The code example below shows how to generate a Data Matrix Code in Java:
Generate Data Matrix ECC200 Code in Java
The following steps elaborate how to create a Data Matrix ECC200 code in Java.
- Initialize an object of BarcodeGenerator class and set the EncodeType for output code.
- Specify the encoding type and pixels for the output code.
- Call the save method to export the generated ECC200 barcode.
The code snippet below is an example of how to generate a Data Matrix ECC200 code in Java:
Get a Free License
You can request a free temporary license to check different features and capabilities of the the API without any limitations.
In this article, you have understood how to generate a Data Matrix Code programmatically in Java. It can be helpful to create a reliable data matrix code that can be corrected even if the code is damaged by 30% of its contents. This feature, along with many other strengths makes it a preferred choice to be used in the avionics and auto industry. However, you can visit the documentation section to learn working with different barcodes. In case of any concerns, please write to us at the forum.