Package br.com.caelum.stella.boleto.transformer

Source Code of br.com.caelum.stella.boleto.transformer.BarcodeGenerator

package br.com.caelum.stella.boleto.transformer;

import java.awt.Color;
import java.awt.Image;

import com.lowagie.text.Element;
import com.lowagie.text.pdf.BarcodeInter25;

/**
* Implementa um gerador de códigos de barras
*
* @author Cauê Guerra
* @author Paulo Silveira
*
*/
class BarcodeGenerator {

    /**
     * Retorna uma imagem com o código de barras para uma determinada String
     *
     * @param code
     */
    static Image generateBarcodeFor(String code,float barHeight) {
        BarcodeInter25 bar = new BarcodeInter25();
        bar.setCode(code);
        bar.setExtended(true);      
        bar.setTextAlignment(Element.ALIGN_LEFT);
        bar.setBarHeight(barHeight);          
        bar.setFont(null);
        bar.setX(0.73f);
        bar.setN(3);         
        return bar.createAwtImage(Color.BLACK, Color.WHITE);
    }
}
TOP

Related Classes of br.com.caelum.stella.boleto.transformer.BarcodeGenerator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.