/** Shows a blank document, in case of a problem in generating the PDF */ private byte[] showBlank() throws DocumentException { final Document document = new Document(PageSize.LETTER); // FIXME - get PageSize from label definition final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final PdfWriter writer = PdfWriter.getInstance(document, baos); document.open(); document.add(new Paragraph("No data have been uploaded. The time is: " + new Date())); final Barcode128 code128 = new Barcode128(); code128.setGenerateChecksum(true); code128.setCode(new Date().toString()); document.add(code128.createImageWithBarcode(writer.getDirectContent(), null, null)); document.close(); return baos.toByteArray(); }
private static Image generate128(PdfContentByte cb, String sku){ Barcode128 code128 = new Barcode128(); code128.setCodeType(Barcode128.CODE_A); code128.setGuardBars(true); code128.setCode(sku); code128.setSize(7); code128.setBaseline(6f); code128.setBarHeight(27f); code128.setX(.70f); return code128.createImageWithBarcode(cb, null, null); }