tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Barcodes > iText > Barcode 3of9

Barcode 3of9 

iText is a free and open source library for creating PDF documents and generating Barcodes in Java. This requires the library iText-5.0.2.jar to be in classpath. The following example shows generating CODE 3of9 Barcode.

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.itext;


import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.Barcode39;
import com.itextpdf.text.pdf.PdfWriter;

public class BarCode39Test {

   @param args
   @throws DocumentException 
   @throws FileNotFoundException 
  public static void main(String[] argsthrows FileNotFoundException, DocumentException {
    Document document = new Document(new Rectangle(PageSize.A4));
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("barcode39.pdf"));;

    //Barcode 3 of 9
    document.add(new Paragraph("Barcode 39"));
    Barcode39 code39 = new Barcode39();
    //Add Barcode to PDF document
        document.add(code39.createImageWithBarcode(writer.getDirectContent(), null, null));


It gives the following output,

CODE 3of9 Barcode



Books Recommendation

bl  br