Example usage for com.itextpdf.text.pdf BarcodeEAN createTemplateWithBarcode

List of usage examples for com.itextpdf.text.pdf BarcodeEAN createTemplateWithBarcode

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf BarcodeEAN createTemplateWithBarcode.

Prototype

public PdfTemplate createTemplateWithBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor) 

Source Link

Document

Creates a template with the barcode.

Usage

From source file:org.unesco.jisis.printsort.BarCodeGenerator.java

public Image createBARCodeEANSUPP(String myTextPrimary, String myTextSupplementary5) {
    PdfTemplate pdfTemplate = contentByte.createTemplate(0, 0);
    BarcodeEAN myBarcodeEAN = new BarcodeEAN();
    myBarcodeEAN.setCodeType(Barcode.EAN13);
    myBarcodeEAN.setCode(myTextPrimary);
    PdfTemplate ean = myBarcodeEAN.createTemplateWithBarcode(contentByte, null, BaseColor.BLUE);
    BarcodeEAN codeSUPP = new BarcodeEAN();
    codeSUPP.setCodeType(Barcode.SUPP5);
    codeSUPP.setCode(myTextSupplementary5);
    codeSUPP.setBaseline(-2);/*from  ww  w  . j  a  v  a 2s  . c o  m*/
    BarcodeEANSUPP eanSupp = new BarcodeEANSUPP(myBarcodeEAN, codeSUPP);
    Image imageEANSUPP = eanSupp.createImageWithBarcode(contentByte, null, BaseColor.BLUE);
    return imageEANSUPP;
}