Home  >  Java Barcoding Library  >  Java Barcode Generation Guide
Java Barcode Generation Guide
Java Barcode Toolkit Package offers the most affordable Java barcode generator for Java professionals. Here are more details for Java Barcode Generator.
Java Barcode Generator - Package Overview
KeepDynamic Java Barcode Generator package is a mature barcode generation toolkit for Java. Single jar file in the package allows Java developers to generate 20+ linear & 2D barcodes in various Java projects. KeepDynamic Java Barcode Generator toolkit includes the following components.
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 to copy barcode folder to your Tomcat application folder, and restart the Tomcat.
Java Barcode Generator - How to Generate Barcode in Java Class?
The following Java code illustrates how to generate a barcode in Java class. And Code 128 is the sample barcode type.
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 Applicaton?
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 Barcode Through HTTP Request?
  1. Install Java Barcode Generator Servlet application to Tomcat or JBoss. Developers need to copy 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 barcode image in HTML or JSP page.
    <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 supports the following Java reporting solutions. Please click to view the details.
Java Barcode Generator - Barcode Property Setting
Java Barcode Generator supports most common linear (1d) and matrix (2d) bar code standards, including: