Java Barcode GS1-128/UCC/EAN-128 Generator

Create, Generate, Draw, Print Barcode GS1-128/UCC/EAN-128 in Java Application


  • 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, PNG, JPEG, EPS & BITMAP
  • Generate GS1-128/EAN-128 barcodes in Jasper Reports, iReport & Eclipse BIRT
  • Completely developed in Java
  • Mature GS1-128/EAN-128 barcode generation Java library used by 2000+ clients
Index
 

Java Barcode GS1-128/UCC/EAN-128 Generator Introduction

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.

 

EAN-128 / GS1-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 EAN 128/GS1 128 Generator - Valid Data Scope

Java EAN 128/GS1 128 Generator encodes:



 

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

GS1 Function Code 1 (FNC1) and the Application Identifier (AI)

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"); 
	    
	        ean128.Format = ImageFormat.Gif;
	        ean128.drawBarcode("java-ean128.gif");
 

Java Barcode Generation FAQ?

  1. How to generate barcode GS1-128/EAN-128 in Java class?

    // 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. How to generate & encode GS1-128/EAN-128 barcodes to EPS?

    // 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. How to create & encode GS1-128/EAN-128 image in html or jsp pages?



    • Under demo package, copy barcode folder and its contents to your tomcat.

    • Start tomcat, navigate to http://YourDomain:Port/barcode/barcode?DATA=(00)350123451234567894&TYPE=EAN128

    • To create bar code images in html or jsp pages, you can insert a image tag (img) into your page.
      For example, <img src="http://YourDomain:Port/barcode/barcode?DATA=(00)350123451234567894&TYPE=EAN128" />



  4. How to create & print barcode GS1-128/EAN-128 image in Java Servlet class?

    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); 
            } 
        } 
    } 


  5. How to generate GS1-128/EAN-128 barcode image in Jasper Reports?

    Complete Guide for Barcode Generation in Jasper Reports

  6. How to generate GS1-128/EAN-128 barcode image in iReport?

    Complete Guide for Barcode Generation in iReport

  7. How to generate GS1-128/EAN-128 barcode image in Eclipse BIRT?

    Complete Guide for Barcode Generation in Eclipse BIRT

  8. How to set generated GS1-128/EAN-128 barcode image width and height?

    1) You can set barcode image width and height through properties barcodeWidth and barcodeHeight values.

    or

    2) You can set X (bar module width) and Y (bar module height) values

 

Java EAN 128/GS1 128 Generator - Property Settings


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

Category Class Properties Servlet Properties Default Comments
Basic data DATA "" value to encode
addCheckSum ADD-CHECK-SUM true addCheckSum property is not applied. Barcode Library will automatically add a check sum in the end.
 
EAN 128
Special
processTilde PROCESS-TILDE false Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is false.
~NNN: is used to represent the ASCII character with the value of NNN. NNN is from 000 - 255.
 
Size Related uom UOM 0 Unit of meature for all size related setting in the library.
0: pixel; 1: inch; 2: cm.
X X 1 width of barcode module (narrow bar), default is 1 pixel
Y Y 30 barcode module height, default is 30 pixel
barcodeWidth BARCODE-WIDTH 0 generted barcode image width
barcodeHeight BARCODE-HEIGHT 0 generted barcode image height
leftMargin LEFT-MARGIN 0 image left margin
rightMargin RIGHT-MARGIN 0 image right margin
topMargin TOP-MARGIN 0 image top margin
bottomMargin BOTTOM-MARGIN 0 image bottom margin
resolution RESOLUTION 72 in DPI
rotate ROTATE IBarcode.ROTATE_0 (0) valid values:
IBarcode.ROTATE_0 (0),
IBarcode.ROTATE_90 (1),
IBarcode.ROTATE_180 (2),
IBarcode.ROTATE_270 (3)
 
Text
&
Color
showText SHOW-TEXT true If true, display barcode data text, otherwise do not display.
showCheckSumChar SHOW-CHECKSUM-CHAR true If true, display the check sum character in the end of data, if there is a check sum.
textFont TEXT-FONT Arial, Plain, 11 Barcode text font style
textMargin TEXT-MARGIN 6 Space between barcode and barcode data text, default is 6 pixel



All Java Barcode Generator Supporting Bar Code Symbology Types



Java Barcode Generator Tutorial