Barcodes are graphic symbols used to identify products. In the retail industry, GS1-128 barcodes are ubiquitous. Many companies around the world exchange data using the GS1-128 standard. As an eCommerce standard, it makes it possible for a company to provide accurate and reliable information about its products. In this article, we will learn how to generate GS1-128 barcodes. After following the mentioned steps, we will have our own GS1-128 Barcode Generator in Java. So let’s begin.
The article shall cover the following topics:
- Java GS1-128 Barcode Generator API
- Generate GS1-128 Barcode in Java
- Generate UPC-A GS1 128 Coupon
- Customize Barcode Appearance
Java GS1-128 Barcode Generator API
We will be using the Aspose.BarCode for Java API for generating GS1-128 barcodes. It is a robust, reliable, and easy-to-use Java API for barcode generation and recognition. It supports a wide range of 1D & 2D barcode types.
Please either download the JAR of the API or add the following pom.xml configuration in a Maven-based Java application.
<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.10</version>
</dependency>
Generate GS1-128 Barcode in Java
We can easily generate a GS1-128 barcode by following the steps given below:
- Firstly, create an instance of the BarcodeGenerator class with the EncodeType as an argument.
- Next, specify the text to encode.
- After that, set the barcode size value in pixels.
- Finally, save the output using the save() method. It takes the output file path as an argument.
The following code example shows how to generate a GS1-128 barcode in Java.
Generate UPC-A GS1 128 Coupon in Java
Similarly, we can also generate a barcode label with an additional GS1-128 coupon barcode placed in the same image by following the steps mentioned earlier. However, we need to set the EncodeType as UPCA_GS_1_CODE_128_COUPON in the first step.
The following code example shows how to generate a UPC-A GS1 Code 128 Coupon in Java.
Customize GS1 128 Coupon Appearance in Java
We can also customize the appearance of the barcode by following the steps mentioned earlier. However, we need to specify additional properties before saving the image in the final step.
The following code example shows how to customize the barcode appearance of GS1 128 Coupon in Java.
Get a Free License
You can get a free temporary license to try the library without evaluation limitations.
Conclusion
In this article, we have learned about GS1-128 barcode and how to generate a GS1-128 barcode in Java. We have also seen how to generate UPC-A GS1-128 coupon programmatically. Besides, you can learn more about Aspose.BarCode for Java API using documentation. In case of any ambiguity, please feel free to contact us on our free support forum.