tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Barcodes > Barbecue > Global Trade Item Number Barcode

Global Trade Item Number Barcode 

Barbecue is a free and open source Java library for Barcode generation. This requires the library barbecue-1.5-beta1.jar to be in classpath. The following example shows generating Global Trade Item Number Barcode.

File Name  :  
com/bethecoder/tutorials/barbecue/GTINBarCodeTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.barbecue;

import java.io.File;

import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.BarcodeFactory;
import net.sourceforge.barbecue.BarcodeImageHandler;

public class GTINBarCodeTest {

  public static void main (String [] argsthrows Exception {

    //Get GTIN-12 Barcode instance from the Factory
    Barcode barcode = BarcodeFactory.createGlobalTradeItemNumber("012345678905");

    File imgFile = new File("testgtin12.png");

    //Write the bar code to PNG file
    BarcodeImageHandler.savePNG(barcode, imgFile);
  }
}
   

It gives the following output,

Global Trade Item Number Barcode



 
  


  
bl  br