List of usage examples for com.itextpdf.text Image ORIGINAL_NONE
int ORIGINAL_NONE
To view the source code for com.itextpdf.text Image ORIGINAL_NONE.
Click Source Link
From source file:com.docdoku.server.extras.TitleBlockGenerator.java
License:Open Source License
private void generateLyfeCycleState(Paragraph preface, ResourceBundle bundle) { // Table title preface.add(new Paragraph(bundle.getString("lifecycle") + " : " + lifeCycleState, BOLD_12)); addEmptyLine(preface, 1);/*from w ww . j a va 2 s . c om*/ PdfPTable lifeCycleTable = new PdfPTable(5); lifeCycleTable.setWidthPercentage(100f); PdfPCell cell; for (Activity activity : workflow.getActivities()) { boolean headerRendered = false; for (Task task : activity.getTasks()) { if (task.isApproved() || task.isRejected()) { if (!headerRendered) { // Table head cell = new PdfPCell(new Phrase(activity.getLifeCycleState(), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setColspan(5); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.task"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.date"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.author"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.comments"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(bundle.getString("lifecycle.signature"), BOLD_12)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); lifeCycleTable.addCell(cell); headerRendered = true; } // Table body cell = new PdfPCell(new Phrase(task.getTitle(), NORMAL_12)); lifeCycleTable.addCell(cell); SimpleDateFormat simpleFormat = new SimpleDateFormat(bundle.getString("date.format")); cell = new PdfPCell(new Phrase(simpleFormat.format(task.getClosureDate()), NORMAL_12)); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(task.getWorker().getName(), NORMAL_12)); lifeCycleTable.addCell(cell); cell = new PdfPCell(new Phrase(task.getClosureComment(), NORMAL_12)); lifeCycleTable.addCell(cell); if (task.getSignature() != null) { try { byte[] imageByte; int indexOfFirstComma = task.getSignature().indexOf(","); String base64 = task.getSignature().substring(indexOfFirstComma + 1, task.getSignature().length()); imageByte = DatatypeConverter.parseBase64Binary(base64); Image image = Image.getInstance(imageByte); image.setCompressionLevel(Image.ORIGINAL_NONE); image.scaleToFit(SIGNATURE_SIZE_W, SIGNATURE_SIZE_H); cell = new PdfPCell(image); lifeCycleTable.addCell(cell); } catch (Exception e) { cell = new PdfPCell(new Phrase(bundle.getString("signature.error"), NORMAL_12)); lifeCycleTable.addCell(cell); } } else { cell = new PdfPCell(new Phrase("")); lifeCycleTable.addCell(cell); } } } } preface.add(lifeCycleTable); }