Example usage for com.itextpdf.text.pdf BarcodePDF417 PDF417_FORCE_BINARY

List of usage examples for com.itextpdf.text.pdf BarcodePDF417 PDF417_FORCE_BINARY

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf BarcodePDF417 PDF417_FORCE_BINARY.

Prototype

int PDF417_FORCE_BINARY

To view the source code for com.itextpdf.text.pdf BarcodePDF417 PDF417_FORCE_BINARY.

Click Source Link

Document

One single binary segment is used

Usage

From source file:com.andom.websevice.MyWebService.java

@WebMethod(operationName = "imprimir")
public ObjFactura imprimir(@WebParam(name = "session") String session,
        @WebParam(name = "ObjProducto") ObjProducto objproducto) {

    try {//from www.j a v  a2 s .  co m

        if ("123456".equals(session) && objproducto != null) {
            ObjFactura objFactura = new ObjFactura();
            BarcodePDF417 pdf417 = new BarcodePDF417();
            String text = "Testing Java Barcode";
            pdf417.setCodeRows(5);
            pdf417.setCodeColumns(18);
            pdf417.setErrorLevel(5);
            pdf417.setOptions(BarcodePDF417.PDF417_FORCE_BINARY);
            pdf417.setText(text.getBytes("ISO-8859-1"));

            java.awt.Image img2;
            img2 = pdf417.createAwtImage(Color.BLACK, Color.WHITE);
            File file1 = new File("D://barraPDF417.PNG");
            BufferedImage x1 = imageToBufferedImage(img2);
            writeImageToPNG(file1, x1);
            Image awt = (Image) x1;
            objFactura.setTimbre(awt);
            objFactura.setFactura(1);
            return objFactura;
        } else {
            return null;
        }
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(MyWebService.class.getName()).log(Level.SEVERE, null, ex);
    } catch (Exception ex) {
        Logger.getLogger(MyWebService.class.getName()).log(Level.SEVERE, null, ex);
    }
    //   ObjImage ojpadre2 = null;
    return null;
}