Example usage for com.lowagie.text.pdf BarcodeInter25 setFont

List of usage examples for com.lowagie.text.pdf BarcodeInter25 setFont

Introduction

In this page you can find the example usage for com.lowagie.text.pdf BarcodeInter25 setFont.

Prototype

public void setFont(BaseFont font) 

Source Link

Document

Sets the text font.

Usage

From source file:br.com.nordestefomento.jrimum.bopepo.view.guia.ViewerPDF.java

License:Apache License

private void setCodigoBarra() throws DocumentException {
    // Montando o cdigo de barras.
    BarcodeInter25 barCode = new BarcodeInter25();
    barCode.setCode(guia.getCodigoDeBarras().write());

    barCode.setExtended(true);//ww  w  .java 2  s  . c  o m
    barCode.setBarHeight(40);
    barCode.setFont(null);
    barCode.setN(3);

    PdfContentByte cb = null;

    // Verifcando se existe o field(campo) da imagem no template do boleto.
    float posCampoImgLogo[] = form.getFieldPositions("txtCodigoBarra");

    if (isNotNull(posCampoImgLogo)) {

        RectanglePDF field = new RectanglePDF(posCampoImgLogo);

        cb = stamper.getOverContent(field.getPage());
        Image imgBarCode = barCode.createImageWithBarcode(cb, null, null);

        PDFUtil.changeField2Image(stamper, field, imgBarCode);
    }
}

From source file:br.com.nordestefomento.jrimum.bopepo.view.ViewerPDF.java

License:Apache License

private void setCodigoBarra() throws DocumentException {

    // Montando o cdigo de barras.
    BarcodeInter25 barCode = new BarcodeInter25();
    barCode.setCode(boleto.getCodigoDeBarras().write());

    barCode.setExtended(true);/*from   w w w. jav  a2  s. c  o m*/
    barCode.setBarHeight(40);
    barCode.setFont(null);
    barCode.setN(3);

    // FICHA DE COMPENSAO
    PdfContentByte cb = null;

    // Verifcando se existe o field(campo) da imagem no template do boleto.
    float posCampoImgLogo[] = form.getFieldPositions("txtFcCodigoBarra");

    if (isNotNull(posCampoImgLogo)) {

        RectanglePDF field = new RectanglePDF(posCampoImgLogo);

        cb = stamper.getOverContent(field.getPage());
        Image imgBarCode = barCode.createImageWithBarcode(cb, null, null);

        PDFUtil.changeField2Image(stamper, field, imgBarCode);
    }
}

From source file:classroom.filmfestival_c.Movies23.java

public static void fillForm(String filename, AccreditationData data, OutputStream out)
        throws IOException, DocumentException {

    PdfReader reader = new PdfReader(filename);
    PdfStamper stamper = new PdfStamper(reader, out);

    AcroFields form = stamper.getAcroFields();
    form.setField("name", data.getName());
    form.setFieldProperty("type", "textcolor", data.getTypeColor(), null);
    form.setField("type", data.getTypeName());
    form.setField("number", data.getNumber(false));
    form.setFieldProperty("filmfestival", "bgcolor", data.getTypeColor(), null);
    form.regenerateField("filmfestival");

    if (data.getPhoto() != null) {
        PushbuttonField bt = form.getNewPushbuttonFromField("photo");
        bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY);
        bt.setProportionalIcon(true);// w  ww  . j a  v a 2s  .c o m
        bt.setImage(data.getPhoto());
        form.replacePushbuttonField("photo", bt.getField());
    }

    try {
        BarcodeInter25 code = new BarcodeInter25();
        code.setGenerateChecksum(true);
        code.setBarHeight(mm2pt(3));
        code.setCode(data.getNumber(true));
        code.setFont(null);
        PdfContentByte cb = new PdfContentByte(stamper.getWriter());
        PdfTemplate template = code.createTemplateWithBarcode(cb, null, null);
        PushbuttonField bt = form.getNewPushbuttonFromField("barcode");
        bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY);
        bt.setProportionalIcon(false);
        bt.setTemplate(template);
        form.replacePushbuttonField("barcode", bt.getField());
    } catch (Exception e) {
        // not a valid code, do nothing
    }

    stamper.setFormFlattening(data.isFlatten());
    stamper.close();
}

From source file:org.jrimum.bopepo.pdf.CodigoDeBarras.java

License:Apache License

public Image toImage() {

    // Montando o cdigo de barras.
    BarcodeInter25 barCode = new BarcodeInter25();
    barCode.setCode(this.write());

    barCode.setExtended(true);//  w w  w. j  av a  2s  .co  m
    barCode.setBarHeight(35);
    barCode.setFont(null);
    barCode.setN(3);

    return barCode.createAwtImage(Color.BLACK, Color.WHITE);
}