Home  >  Products  >  Java Barcode  >  Java Barcode Generation Guide


Java Barcode Generation Guide | Java Barcode Generator User Guide



Java Barcode offers the most affordable Java barcode generator for barcode Java professionals.


[Java Barcode Details]     [Download Java Barcode Free Trial Package]


Java Barcode Generator - Package Overview

KeepDynamic Java Barcode generator package is a mature barcode generator Java library. Single jar file in the package allows Java developers to generate 40+ linear & 2D barcodes in various Java projects. KeepDynamic Java Barcode generator package includes the following components:

  1. Java Barcode class library - includes all necessary Java class files for java barcode generation
  2. Java Servlet application - to generate barcodes in HTTP request


Java Barcode Generator - Installation

Java Barcode Generator is easy to install. Developers just add jar file to the Java project classpath environment.

To install Java Barcode Generator Servlet application to Tomcat or JBoss, developers need copy the barcode folder to your Tomcat application folder, and restart the Tomcat.


Java Barcode Generator - How to generate barcodes in Java Class?

The following Java code illustrates how to generate a barcode in Java class:

BarCode barcode = new BarCode(); 

// set code 128 barcode properties
barcode.setSymbologyType(BarCode.CODE128); 
barcode.setCodeText("CODE128"); 
  
// draw and generate barcode to buffered image object
BufferedImage barcodeImage = barcode.drawBarCode2Image();


Java Barcode Generator - How to generate linear & 2D barcodes to Java Servlet applicatons?

The following Java code illustrates how to generate a barcode in Java Servlet class:

public class BarcodeServlet extends HttpServlet { 
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException 
    { 
        try { 
            BarCode barcode = new BarCode(); 

            // set barcode properties 
            barcode.setSymbologyType(BarCode.CODE128); 
            barcode.setCodeText("CODE128");
            
            // draw and generate barcode to response's ServletOutputStream 
            ServletOutputStream servletoutputstream = response.getOutputStream(); 
            
            barcode.drawBarCode2Stream(servletoutputstream); 

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


Java Barcode Generator - How to create barcodes through HTTP Request?

  1. Install Java Barcode Generator Servlet application to Tomcat or JBoss, developers need copy the barcode folder to your Tomcat application folder, and restart the Tomcat.

  2. After Tomcat restarted, open your browser and navigate to http://your_tomcat_url:port/barcode/barCode?code-text=CODE128&symbology-type=8

  3. You can also insert barcodes in HTML or JSP pages.

    <img src="http://your_tomcat_url:port/barcode/barCode?code-text=CODE128&symbology-type=8">


Java Barcode Generator - How to draw & print barcode to java.awt.Image Object

The following Java source code shows how to generate a barcode in a java.awt.Image object:

private static void demoLinearBarcode() throws Exception 

    BarCode barcode = new BarCode(); 

    // set barcode properties 
    barcode.setSymbologyType(BarCode.CODE128); 
    barcode.setCodeText("CODE128"); 

    // create image object 
    java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(300,300,java.awt.image.BufferedImage.TYPE_BYTE_INDEXED ); 
    // get graphic context of image 
    java.awt.Graphics2D imgGraphics = image.createGraphics(); 

    // draw barcode to specified location in Rectangle 
    barcode.paintBarCode(imgGraphics, new java.awt.Rectangle(0, 0, 300, 300)); 
}


Java Barcode Generator - Java Reporting Implementation

Java Barcode Generator supports embeding barcodes in Java reporting solutions, like Eclipse BIRT, Jasper Reports, and iReport.

KeepDynamic Java Barcode generator support the following Java reporting solutions, click to view the details:



Java Barcode Generator - Barcode Type Property Settings

Java Barcode Generator supports most common linear (1d) and matrix (2d) bar code standards, including:

2D Barcodes Code-39 related Code-128 related Code-25 related EAN/UPC related Other Linear Barcodes
Data Matrix

PDF-417

QR-Code

Code-39

Code-93

Code-128

GS1-128/UCC/EAN-128
Code 2 of 5

Interleaved 2 of 5

ITF-14

Identcode

Leitcode

EAN-8

EAN-13

ISBN

ISSN

UPC-A

UPC-E
Codabar

Code-11

POSTNET

PLANET

USPS Intelligent Mail Barcode (OneCode)

RM4SCC

MSI Plessey