Home > Java Barcode Generator > Java Barcode Generation Guide > Java GS1-128 (UCC/EAN-128) Barcode Generator


Java GS1-128/EAN-128 Generator Library

How to create, print GS1-128 (UCC/EAN-128) in Java class, web, desktop application, JasperReports, BIRT reports?
  • Comprehensive barcoding toolkit for Java with advanced GS1-128/EAN-128 generation functions
  • 100% build in Java, compatible with JDK 1.4 and later version
  • Easily generate GS1-128/EAN-128 barcodes in Java applications with virtual machine
  • Generate high-readability GS1-128/EAN-128 barcodes in JPEG, GIF & PNG image formats
  • Generate GS1-128/EAN-128 barcode in Jasper Reports & iReport
  • Generate GS1-128/EAN-128 barcode in Eclipse BIRT
  • Professional Java Barcode Generator library since 2003
  • Four types of royalty-free developer license with lifelong to use
Java Barcode is a Java barcode generator that produces high quality Code 128 barcode and other 1D (linear) and 2D (matrix) barcodes for use in Java applications, Jasper Reports, iReport, and Eclipse BIRT projects.




GS1-128/EAN-128 Barcode Introduction
GS1-128 / EAN-128 is also known as EAN-128, UCC-128, USS-128, GS1-128, UCC.EAN-128, GTIN-128, UCC-12, EAN/UCC-13, EAN/UCC-14.
The UCC/EAN-128 Symbology is a subset of the more general Code 128 Symbology. UCC/EAN-128 was developed to provide a worldwide format and standard for exchanging common data between companies. While other bar codes simply encode data with no respect for what the data represents, UCC/EAN-128 encodes data and encodes what that data represents.
UCC/EAN-128 has a list of Application Identifiers (AI). The Application Identifier is a 2, 3, or 4-digit number that identifies the type of data which follows. By convention, the Application Identifier is enclosed in parentheses when printed below the barcode (the parentheses are only for visual clarity, and are not encoded in the barcode).

Sample of a UCC/EAN-128 Barcode

How to encode UCC/EAN-128 values using Barcode Library

Introduction
UCC/EAN 128 encodes the so called Element Strings which are composed of an Application Identifier (AI) plus a data field. Each AI identifies the meaning and format of the data following it. Note that the AI has parentheses around it in the human readable text, but the parentheses are not encoded in the barcode.
Encode AI Code
In Barcode Library, developer mush put (dddd) around AI code, for the above sample image, you must set data property = '(21)d12345777(21)12345678'.




GS1-128/EAN-128 Encoding Data Scope
UCC/EAN 128 Barcode for Java supports:
  • all 128 characters of ASCII
  • values 128-255 in accordance with ISO 8859-1. There are referred to as extended ASCII.




How to Generate GS1-128/EAN-128 Barcode in Java Class?
The following Java code illustrates how to create a GS1-128/EAN-128 barcode, and output to various formats.
1     Linear linear = new Linear(); 
2 linear.setType(Linear.EAN128);
3 linear.setData("(21)d12345777(21)12345678");
4 linear.renderBarcode("c:/barcode.gif");

5 BufferedImage bufferedImage = linear.renderBarcode();

6 byte[] barcodeBytes = linear.renderBarcodeToBytes();

7 Graphics2D g = ...
8 Rectangle2D rectangle = ...
9 linear.renderBarcode(g, rectangle);

10 OutputStream outputStream = ...
11 linear.renderBarcode(outputStream);
  • Create a Linear barcode object (line 1)
  • Set Linear object barcode type to GS1-128/EAN-128 (line 2)
  • Set GS1-128/EAN-128 barcode data to encode (line 3)
  • Encode generated GS1-128/EAN-128 barcode into gif image file (line 4)
  • Generate GS1-128/EAN-128 and output to BufferedImage object (line 5)
  • Generate GS1-128/EAN-128 in bitmap and output to byte[] (line 6)
  • Generate GS1-128/EAN-128 and draw to defined area (Rectangle2D) on Graphics2D (line 7-9)
  • Generate GS1-128/EAN-128 and output to OutputStream (line 10-11)


Creating GS1 128 (UCC/EAN 128) Compliant Barcodes in Java

The BarcodeLib Java Barcode Generator allows you to easily add Application Identifiers to GS1 128 / EAN 128 barcodes by enclosing AIs in parentheses.

For example, to encode AI (00) with data 350123451234567894 and AI (21) with data 01234567, pass the string "(00)350123451234567894(21)01234567" to the barcode data property.
How to Set Generated GS1-128/EAN-128 Barcode Image Size?

All Java Barcode Types/Symbologies

Encode Linear Barcodes:
Encode Matrix Barcodes: