Java GS1-128 Generator Tutorial

Generate, create barcode EAN-128 images in Java applications (Class, Servlet, Jasper Report)

Generate, Create, Print, Draw EAN-128 (GS1 128) barcode in Java projects

  • Easy to generate GS1-128/EAN-128 barcodes in Java Class, J2EE applications
  • Simple to redistribute Java GS1-128/EAN-128 barcode library. No registration key. No activation code
  • Generating high quality GS1-128/EAN-128 Bar Code images in GIF, JPEG, & EPS formats
  • Generate GS1-128/EAN-128 barcodes in Jasper Reports, iReport & Eclipse BIRT
  • Completely developed with Java source code
  • Mature GS1-128/EAN-128 barcode generation Java library used by 2000+ clients


How to create, print GS1-128 barcode in Java web, desktop application?

  1. Download Java GS1-128 Barcode Generator library
  2. Install Java GS1-128 barcode generation library into Java project
  3. Start to Create










Java Barcode GS1 128 / EAN 128 Generator Introduction

Top
Java Barcode is a Java barcode generator which generates high quality 1D (linear) and 2D (matrix) barcodes in Java, Jasper Reports, iReport, and Eclipse BIRT projects.

GS1 128 / EAN 128 Introduction

GS1-128 is an application standard of the GS1 implementation using the Code 128 barcode specification. The former correct name was UCC/EAN-128. Other no longer used names have included UCC-128 and EAN-128. GS1-128 uses a series of Application Identifiers to include additional data such as best before dates, batch numbers, quantities, weights and many other attributes needed by the user.

Java GS1 128 / EAN 128 Generator - Valid Data Scope

  • All 128 characters of ASCII
  • Values 128-255 in accordance with ISO 8859-1. There are referred to as extended ASCII.

Creating GS1-128 (UCC/EAN-128) Compliant BarCodes in Java

Top
OnBarcode Java Barcode Generator allows easily to add application identifiers in GS1 128 / EAN 128, by add parentheses to AIs.

For example, to encode AI (00), with data 350123451234567894, with second AI (21), with data 01234567, you need pass string "(00)350123451234567894(21)01234567" to barcode data property

EAN128 barcode = new EAN128();
barcode.setData("(00)350123451234567894(21)01234567"); 
barcode.drawBarcode("C://demo//gs1-128-demo.png");





How to Generate EAN-128 / GS1-128 in Java Class?

Top
Here is some sample code for creating GS1-128 linear barcodes in Java class. If you need to adjust more barcode settings, please view here: Java GS1 128 Generator Demo Source Code
// Create Java EAN128 object 
EAN128 barcode = new EAN128();

// Set EAN128 data text to encode
barcode.setData("(00)350123451234567894");

// Generate EAN128 barcode & print into Graphics2D object
barcode.drawBarcode("Java Graphics2D object");

// Generate EAN128 barcode & encode into GIF format
barcode.drawBarcode("C://barcode-ean128.gif");

// Generate EAN128 barcode & encode into JPEG format
barcode.drawBarcode("C://barcode-ean128.jpg");

// Generate EAN128 barcode & encode into EPS
barcode.drawBarcode2EPS("C://barcode-ean128.eps");




How to Customize, Print GS1-128 Text Label in Java?

Top
You can easily create, customize, print GS1-128 barcode text label font style using Java Barcode Generator library.
  • Set property TextMargin to control the space between GS1-128 bar modules and text label.
  • Disable property AutoResizeBarcodeText to false to customize text label font size manually.
  • Set property TextFont with the specified text font style, size in Font object
Note: The GS1 system recommends to use font "OCR" for GS1-128 text label.

EAN128 barcode = new EAN128();
barcode.setData("(00)395123451234567895");
barcode.setTextMargin(5);
barcode.setAutoResizeBarcodeText(false);
barcode.setTextFont(new Font("ocr-b", Font.PLAIN, 14));
barcode.drawBarcode("C://demo//gs1-128-text-label.png");





How to Create & Encode GS1-128/EAN-128 image in HTML or JSP pages?

Top
  1. Under demo package, copy barcode folder and its contents to your tomcat.
  2. Start tomcat, navigate to http://YourDomain:Port/barcode/barcode?DATA=(00)350123451234567894&TYPE=EAN128
  3. To create bar code images in html or jsp pages, you can insert a image tag (img) into your page
  4. For example, <img src="http://YourDomain:Port/barcode/barcode?DATA=(00)350123451234567894&TYPE=EAN128"/>





How to Create & Print Barcode GS1-128/EAN-128 Image in Java Servlet Class?

Top
import com.onbarcode.barcode.AbstractBarcode; 
import com.onbarcode.barcode.EAN128;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;

public class BarcodeServlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
{
try {
EAN128 barcode = new EAN128();
barcode.setData("(00)350123451234567894");

ServletOutputStream servletoutputstream = response.getOutputStream();

response.setContentType("image/jpeg");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);

// Generate EAN128 barcode & output to ServletOutputStream
barcode.drawBarcode(servletoutputstream);

} catch (Exception e) {
throw new ServletException(e);
}
}
}





How to Generate GS1-128/EAN-128 Barcode Image in Jasper Reports?

Top
With this Java Barcode generator, you can also generate high-quality GS1-128 barcode images in Jasper Report. Here is the tutorial: Complete Guide for Barcode Generation in Jasper Reports




How to Generate GS1-128/EAN-128 Barcode Image in iReport?

Top
This Java Barcode Generator is powerful enough to support creating bulk GS1-128 barcode images in iReport, either though JRRenderable implementation or buildin servlet application. To learn more, here is the guide for you: Complete Guide for Barcode Generation in iReport




How to Generate GS1-128/EAN-128 Barcode Image in Eclipse BIRT?

Top

How to Set Generated GS1-128/EAN-128 Barcode Image Width and Height?

Top
  1. You can set barcode image width and height through properties barcodeWidth and barcodeHeight values.
  2. Or you can set X (bar module width) and Y (bar module height) values




Java EAN 128/GS1 128 Generator - Property Settings

Top
Java EAN 128/GS1 128 Generator in Java Class: com.onbarcode.barcode.EAN128

View the details here: complete GS1-128 barcode property settings in Java class













Common Asked Questions

What is the content of GS1-128?

GS1-128 barcode contains up to 48 characters of GS1 data message. It may encode logistical information, such as batch/lot numbers, product serial number, produce date, expiration date, weights, price. OnBarcode Java GS1-128 Barcode Generator library supports GS1 data message encoding in GS1 supported barcode formats, including GS1-128, GS1 QR Code, Data Matrix, ITF-14, GS1 DataBar, EAN/UPC barcodes.

What is the function code for GS1-128?

The GS1-128 barcode supports one function code Function Code 1 (FNC1). The FNC1 character should be encoded after GS1-128 start character. Using Java Barcode Generator api, the barcode library will automatically encode the FNC1 character in the right position in the Code 128 barcode in Java web and desktop application.

What is the minimum & maximum size for GS1-128 barcode?

  • The minimum width for the X-dimension (the width of the narrowest bar or space) is 0.495 mm.
  • The maximum width for the X-dimension is 1.016 mm
You can customize and apply GS1-128 X dimension through method setX() in Java project.

What is the difference between GS1-128 and GTIN 14?

Both barcode formats encode GS1 business data messages. The GS1-128 barcode can encode multiple GS1 application identities (ID) and their data information, such as serial number, price, production dates. The GTIN 14 (also known as ITF-14, based on Interleaved 2 of 5) can only encode the 14 digits Global Trade Item Number (GTIN).

OnBarcode Java Barcode Generation library allows Java programmers to easily make GS1-128 and ITF-14 barcode in Java applications.

What is the difference between Code 128 and GS1-128?

GS1-128 (also known as EAN-128, UCC-128) is an application of Code 128 required by GS1 System. GS1-128 encodes a subset of Code 128 encoding characters. Using OnBarcode Java Barcode Generator library, you can easily create and customize both Code 128 and GS1-128 barcode images in Java web and desktop apps.




































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.