List of usage examples for com.itextpdf.text.pdf Barcode39 setExtended
public void setExtended(boolean extended)
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 va 2 s . 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:org.com.controller.BarcodeController.java
@RequestMapping(value = "/barprocess", method = RequestMethod.POST) public void barpdfgen(@ModelAttribute(value = "quick") BargenTemp bt, Model m, HttpServletResponse response, HttpServletRequest request, OutputStream outputStream) throws Exception { System.out.println("on process" + bt.getIsbn()); if ("".equals(bt.getIsbn())) { System.out.println("on process 2"); response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "attachment; filename= barcode"); Document document = new Document(new Rectangle(340, 842)); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open();//from w ww .j a v a2 s . c o m PdfContentByte cb = writer.getDirectContent(); int q = Integer.parseInt(bt.getQuantity()); System.out.println("QUANTITU" + q); document.add(new Paragraph("Cod-39: DATE: " + bt.getDate())); document.add(new Paragraph("==========================================")); document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(5); for (int i = 0; i <= q; i++) { Barcode39 code39ext = new Barcode39(); code39ext.setCode(bt.getBno()); code39ext.setStartStopText(false); code39ext.setExtended(true); table.addCell(code39ext.createImageWithBarcode(cb, null, null)); } document.add(table); // step 5 document.close(); autocomplete(bt); //return "null"; } }
From source file:org.unesco.jisis.printsort.BarCodeGenerator.java
/**Creating a barcode image using Barcode39 extended type for myText*/ public Image createBarcode39Extended(String myText) { Barcode39 myBarCode39extended = new Barcode39(); myBarCode39extended.setCode(myText); myBarCode39extended.setStartStopText(false); myBarCode39extended.setExtended(true); Image myBarCodeImage39Extended = myBarCode39extended.createImageWithBarcode(contentByte, null, null); return myBarCodeImage39Extended; }