protected void printPatientCard(AdminPerson person) { try { table = new PdfPTable(1000); table.setWidthPercentage(100); PdfPTable table2 = new PdfPTable(1000); table.setWidthPercentage(100); // Professional card cell = createLabel(" ", 32, 1, Font.BOLD); cell.setColspan(1000); cell.setBorder(PdfPCell.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setPadding(0); table2.addCell(cell); cell = new PdfPCell(table2); cell.setColspan(1000); cell.setBorder(PdfPCell.NO_BORDER); table.addCell(cell); cell = createValueCell(" "); cell.setColspan(1000); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(0); table.addCell(cell); table2 = new PdfPTable(1000); // Name cell = createLabel( ScreenHelper.getTranNoLink("web", "lastname", sPrintLanguage) + ":", 6, 1, Font.ITALIC); cell.setColspan(300); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(1); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table2.addCell(cell); cell = createLabel(person.lastname, 8, 1, Font.BOLD); cell.setColspan(700); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(1); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table2.addCell(cell); // FirstName cell = createLabel( ScreenHelper.getTranNoLink("web", "firstname", sPrintLanguage) + ":", 6, 1, Font.ITALIC); cell.setColspan(300); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(1); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table2.addCell(cell); cell = createLabel(person.firstname, 8, 1, Font.BOLD); cell.setColspan(700); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(1); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table2.addCell(cell); // Date of birth cell = createLabel( ScreenHelper.getTranNoLink("web", "dateofbirth", sPrintLanguage) + ":", 6, 1, Font.ITALIC); cell.setColspan(300); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(1); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table2.addCell(cell); cell = createLabel(person.dateOfBirth, 8, 1, Font.BOLD); cell.setColspan(700); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(1); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table2.addCell(cell); // Registration number cell = createLabel( ScreenHelper.getTranNoLink("web", "idcode", sPrintLanguage) + ":", 6, 1, Font.ITALIC); cell.setColspan(300); cell.setBorder(PdfPCell.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setPadding(1); table2.addCell(cell); cell = createLabel(person.comment, 8, 1, Font.BOLD); cell.setColspan(700); cell.setBorder(PdfPCell.NO_BORDER); cell.setPadding(1); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table2.addCell(cell); // Barcode PdfContentByte cb = docWriter.getDirectContent(); Barcode39 barcode39 = new Barcode39(); barcode39.setCode("A" + person.comment); barcode39.setAltText(""); barcode39.setSize(1); barcode39.setBaseline(0); barcode39.setBarHeight(20); Image image = barcode39.createImageWithBarcode(cb, null, null); cell = new PdfPCell(image); cell.setBorder(PdfPCell.NO_BORDER); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setColspan(1000); cell.setPadding(0); table2.addCell(cell); cell = new PdfPCell(table2); cell.setColspan(700); cell.setBorder(PdfPCell.NO_BORDER); table.addCell(cell); // Photo image = null; try { image = Image.getInstance(DatacenterHelper.getPatientPicture(person.comment)); } catch (Exception e1) { e1.printStackTrace(); } if (image != null) { image.scaleToFit(130, 72); cell = new PdfPCell(image); } else { cell = new PdfPCell(); } cell.setBorder(PdfPCell.NO_BORDER); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setColspan(300); cell.setPadding(0); table.addCell(cell); // Horizontal line cell = new PdfPCell(); cell.setBorder(PdfPCell.BOTTOM); cell.setColspan(1000); table.addCell(cell); table2 = new PdfPTable(2000); cell = createLabel( ScreenHelper.getTranNoLink("web", "deliverydate", sPrintLanguage), 6, 1, Font.ITALIC); cell.setColspan(550); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingRight(5); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); table2.addCell(cell); cell = createLabel(ScreenHelper.stdDateFormat.format(new java.util.Date()), 6, 1, Font.BOLD); cell.setColspan(450); cell.setBorder(PdfPCell.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setPadding(0); table2.addCell(cell); // Expiry data cell = createLabel( ScreenHelper.getTranNoLink("web", "expirydate", sPrintLanguage), 6, 1, Font.ITALIC); cell.setColspan(550); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingRight(5); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); table2.addCell(cell); long day = 24 * 3600 * 1000; long year = 365 * day; long period = MedwanQuery.getInstance().getConfigInt("cardvalidityperiod", 5) * year - day; cell = createLabel( ScreenHelper.stdDateFormat.format( new java.util.Date(new java.util.Date().getTime() + period)), 6, 1, Font.BOLD); cell.setColspan(450); cell.setBorder(PdfPCell.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setPadding(0); table2.addCell(cell); cell = new PdfPCell(table2); cell.setColspan(1000); cell.setBorder(PdfPCell.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setPadding(1); table.addCell(cell); cell = createLabel( ScreenHelper.getTranNoLink("web", "cardfooter2", sPrintLanguage), 6, 1, Font.ITALIC); cell.setColspan(1000); cell.setBorder(PdfPCell.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cell.setPadding(0); table.addCell(cell); doc.add(table); } catch (Exception e) { e.printStackTrace(); } }