>
       .NET Barcode for WinForms          ASP.NET Barcode          .NET Barcode Reader          Java Barcode          Java Barcode Reader
Home > Java Barcode > Java GS1 128 (UCC/EAN-128) Generator

Java EAN-128 Generator

Java EAN-128 Generation package to generate EAN-128 linear barcodes in Java applications.

  • Mature Java EAN-128 package consists of class library contains all necessary class files for java EAN-128 barcode generation.

  • Easy encapsulation, integration and customization are supported with JavaBean obeying a particular convention under a developmental environment.

  • Generate, create EAN-128 in Java class, Java bean, Servlet, EJB.

  • Java EAN-128 can be easily generated on any operating system with a JVM.

  • Generate EAN-128 barcodes in Jasper Reports, iReport & Eclipse BIRT

  • Compatible with Headless Java, under which images can be generated without a graphic environment in JDK 1.4 and above.

Java EAN-128 Generator - Overview

Java EAN-128 generator is a mature and reliable Java barcode generation component for creating EAN-128 barcodes in Java, Jasper Reports, iReport, and Eclipse BIRT projects. High-quality EAN-128 barcode images can be drawn and printed into GIF, BMP, PNG, JPEG/JPG & TIFF formats with Java EAN-128 barcode generator. Rich barcode options are provided to customize EAN-128 barcode properties in accordance with your needs.

EAN-128 information:

EAN-128: also called UCC-128 or GS1 128, is another kind of Code 128 based symbologies, which is a subset of Code 128. It is widely used in shipping and packaging industries to indentify the encoded information of the container and pallet levels in the supply chain.

Available encoding data:

all 128 characters of ASCII(0-127).


The structure of a EAN-128 :

1. A Code-128 Start character (A, B, or C).
2. A Code-128 FNC1 character (character 102).
3. Application Identifier (from AI table corresponding to data to be encoded).
4. Data to be encoded (format depends on AI).
5. A Code-128 checksum character.


Java EAN-128 Generator Implementation to Generate EAN-128

1. Generate EAN-128 in Java class with the changing of barcode properties.

// 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";);


2. Generate & encode EAN-128 to EPS with changing the values concerned.

// Create Java EAN128 object
EAN128 barcode = new EAN128();

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

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


3. Generate & encode EAN-128 in html or jsp pages.

1. Copy barcode folder and its contents from demo package to Apache Tomcat.

2. Start Apache Tomcat, go to http://YourDomain:Port/barcode/barcode?DATA=1234567&TYPE=EAN128

3. Insert an image tag (img) into your page. For example,

<imgsrc="http://YourDomain:Port/barcode/barcode?DATA=1234567&TYPE=EAN128" />

EAN-128 Property Settings in GS1 128 Java Barcode Generator

EAN-128 Basic Settings

Properties Value
Comments
Property URL Options Default
data DATA (Data to encode in the Codabar) ""

EAN-128 value to encode

EAN-128 Character Set:
  • all 128 characters of ASCII(0-127);

addCheckSum ADD-CHECK-SUM (Data to encode in the Codabar) false

addCheckSum property is not applied here. Code 2of 5does not require any checksum.

EAN-128 Special Settings

Properties Value
Comments
Property URL Options Default
processTilde
PROCESS-TILDE
ture or false
false

Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data.

* 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
Strings from "~256" to "~299" are unused
* 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
Strings from "~665536" to "~699999" are unused
* for GS1 AI Code:
~ai2: AI code with 2 digits
~ai3: AI code with 3 digits
~ai4: AI code with 4 digits
~ai5: AI code with 5 digits
~ai6: AI code with 6 digits
~ai7: AI code with 7 digits

EAN-128 Text Settings

Properties Value
Comments
Property URL Options Default
showText

SHOW-TEXT
true or false
true


Show text underneath the barcode

textColor

TEXT-COLOR
Color
black

Color of the shown text

textFont
TEXT-FONT
Font
new Font("Arial",Font.PLAIN,11)

The font, font style and font size of the text

textMargin
TEXT-MARGIN
float
6

The space between the text and the barcode symbol

EAN-128 Size Settings

Properties Value
Comments
Property URL Options Default
rotate

ROTATE
Degree0, 90, 180, 270
0 (Barcode.ROTATE)

Rotate the Angle of the Codabar images

autoResize

AUTO-RESIZE
true or false
false

Auto resize the generated barcode image

barcodeHeight
BARCODE-HEIGHT
float
0

Barcode image Height

barcodeWidth
BARCODE-WIDTH
float
0

Barcode image Width

bottomMargin
BOTTOM-MARGIN
float
0

Barcode image bottom margin size
leftMargin LEFT-MARGINE float 0


Barcode image left margin size

rightMargin RIGHT-MARGIN float 0

Barcode image right margin size.

topMargin TOP-MARGIN float 0


Barcode image Top margin size
barAlignment BARALIGMENT int 1(center)


Barcode horizontal alignment inside the image. 0: left, 1: center, 2: right.
uom
UOM
Pixel, Cm, or Inch
0(Pixel)

Unit of Measure for all numeric properties.Valid values: 0: pixel; 1: inch; 2: cm.
X X float 1

Width of barcode bar module (narrow bar), default is 1 pixel

Y Y float 30

Height of barcode bar module, default is 30 pixel

EAN-128 Color Settings

Properties Value
Comments
Property URL Options Default
backColor
BACK
-COLOR
Color
white

Barcode image background color

foreColor
FORE
-COLOR
Color
black
Barcode image foreground color

EAN-128 Image Settings

Properties Value
Comments
Property URL Options Default
resolution
RESOLUTION
int
72

Resolution of Codabar Image, Dots Per Inch

Method

// generate barcode and output to OutputStream object
public boolean drawBarcode(OutputStream outputStream) throws Exception

// generate barcode into a new BufferedImage object
public BufferedImage drawBarcode() throws Exception

/*
Use this method to generate barcode, and save into gif or jpeg files
1. to save into gif file, filename ends with ".gif", like "c:\\barcode.gif"
2. to save into jpeg file, filename ends with ".jpg", like "c:\\barcode.jpg"
*/

public byte[] drawBarcodeToBytes() throws Exception

public boolean drawBarcode(String imageFile) throws Exception

// Generate barcode and save into EPS file, the filename must ends with ".eps"
public void drawBarcode2EPS(String filename) throws Exception

// Generate barcode on Graphics2D object within certain area
public void drawBarcode(Graphics2D g, Rectangle2D rectangle) throws Exception