tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Barcodes > Barbecue > Save Barcode As Jpeg

Save Barcode As Jpeg 

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 how to save CODE 128B Barcode as JPEG image.

File Name  :  
com/bethecoder/tutorials/barbecue/BarCodeJpegTest.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 BarCodeJpegTest {

  public static void main (String [] argsthrows Exception {

    //Get 128B Barcode instance from the Factory
    Barcode barcode = BarcodeFactory.createCode128B("be the coder");

    File imgFile = new File("test128b.jpg");

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

It gives the following output,

CODE 128B Barcode



 
  


  
bl  br