List of usage examples for com.itextpdf.text.pdf Barcode39 setFont
public void setFont(BaseFont font)
From source file:com.divudi.bean.BarcodeController.java
public byte[] getBarcodeBytes(String code) { Barcode39 code39 = new Barcode39(); code39.setCode(code);/* w w w. j a v a 2s.c o m*/ code39.setFont(null); code39.setExtended(true); Image image = null; try { image = Image.getInstance(code39.createAwtImage(Color.BLACK, Color.WHITE), null); } catch (BadElementException | IOException ex) { Logger.getLogger(BarcodeController.class.getName()).log(Level.SEVERE, null, ex); } return image.getRawData(); }
From source file:fc.extensions.itext.Writer.java
License:MIT License
public void writeBarcode(String barcode, float leftX, float bottomY, float scalePercent, boolean isShowCode) throws Exception { Barcode39 code39 = new Barcode39(); code39.setStartStopText(false);/*from ww w . j ava 2 s. c om*/ code39.setTextAlignment(PdfContentByte.ALIGN_LEFT); if (!isShowCode) { code39.setFont(null); } code39.setCode(barcode); Image image = code39.createImageWithBarcode(pdfWriterCB, this.baseColor, this.baseColor); image.setAbsolutePosition(leftX, bottomY); image.scalePercent(scalePercent); pdfWriterCB.addImage(image); }