List of usage examples for com.itextpdf.text.pdf PdfPCell PdfPCell
public PdfPCell()
PdfPCell
. From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable imageBlock(String realPath, String path) throws IOException, BadElementException, DocumentException { Font fontArialBold = FontFactory.getFont("Courier", 18f, Font.NORMAL); table = new PdfPTable(1); table.setWidths(new float[] { 5.9f }); table.setWidthPercentage(100f);/*from w w w . j ava 2 s.co m*/ cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); Image img = Image.getInstance(realPath + path); img.scalePercent(90); img.setAlignment(Element.ALIGN_CENTER); cell.addElement(img); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); p = new Paragraph(12f, " (866) 326-6648", fontArialBold); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); String companyWebsite = new PropertyDAO().getProperty( companyCode.equalsIgnoreCase("03") ? "application.ECU.website" : "application.OTI.website"); p = new Paragraph(28f, " " + companyWebsite, fontArialBold); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable headerPage(String voyageHeading) throws DocumentException { table = new PdfPTable(1); table.setWidths(new float[] { 6.9f }); table.setWidthPercentage(100f);/*from w ww . j av a2s . c o m*/ Font fontArialBold = FontFactory.getFont("Courier", 25f, Font.BOLD); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(32f, "" + voyageHeading, fontArialBold); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(1); p = new Paragraph(25f, " ", fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable informationBlock(String companyName, String portofDischarge, String finalDestination) throws IOException, BadElementException, DocumentException { table = new PdfPTable(1); table.setWidthPercentage(100f);/*w ww .j a v a2 s. c o m*/ Font fontArialNormal = FontFactory.getFont("Courier", 12f, Font.NORMAL); Font fontArialBold = FontFactory.getFont("Courier", 12f, Font.BOLD); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(5f, "To Name : " + companyName + "- Voyage Notice", fontArialNormal); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(25f, "Company : " + companyName + ", INC", fontArialNormal); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(25f, "Voyage Port of Discharge (POD) : " + portofDischarge, fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(9f, "Shipment Final Destination (FD) : " + finalDestination, fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPCell allocateCell(String values, boolean border) { Font fontArialBold = FontFactory.getFont("Courier", 8f, Font.NORMAL); cell = new PdfPCell(); cell.setBorder(0);/*from ww w .ja va 2 s .co m*/ p = new Paragraph(9f, values, fontArialBold); p.setAlignment(Element.ALIGN_LEFT); if (border) { cell.setBorderWidthRight(0.6f); } cell.addElement(p); return cell; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable changesBlock(LclSsDetail lclSsDetail, LclExportNotiFicationForm lclExportNotiFicationForm) throws IOException, BadElementException, DocumentException, Exception { table = new PdfPTable(2); table.setWidthPercentage(100f);//from w ww .j a v a 2 s. c om Font fontArialNormal = FontFactory.getFont("Courier", 12f, Font.NORMAL); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(9f, "Voyage Information Was : ", fontArialNormal); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); Date changedDatetime = lclExportNotiFicationForm.getEnterDateTime() != null ? lclExportNotiFicationForm.getEnterDateTime() : new Date(); p = new Paragraph(9f, "Changes As Of: " + DateUtils.formatDate(changedDatetime, "MM/dd/yyyy"), fontArialNormal); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); cell.setBorderWidthBottom(0.6f); table.addCell(cell); if (lclSsDetail != null) { String stateValue = lclSsDetail.getDeparture().getStateId() != null ? lclSsDetail.getDeparture().getStateId().getCode() : ""; String vessel = "", pier = "", portLrd = "", sail_date = "", eta_date = "", ss_line = "", ss_voyage = ""; if (!"preview".equalsIgnoreCase(lclExportNotiFicationForm.getNoticeStatus())) { vessel = lclExportNotiFicationForm.getVessel() != null ? lclExportNotiFicationForm.getVessel() : ""; portLrd = lclExportNotiFicationForm.getPortLrd() != null && !"0".equalsIgnoreCase(lclExportNotiFicationForm.getPortLrd()) ? lclExportNotiFicationForm.getPortLrd() : ""; sail_date = lclExportNotiFicationForm.getSailDate() != null ? DateUtils.formatDate(lclExportNotiFicationForm.getSailDate(), "MM/dd/yyyy") : ""; eta_date = lclExportNotiFicationForm.getEtaDate() != null ? DateUtils.formatDate(lclExportNotiFicationForm.getEtaDate(), "MM/dd/yyyy") : ""; ss_line = lclExportNotiFicationForm.getSsLine() != null ? lclExportNotiFicationForm.getSsLine() : ""; ss_voyage = lclExportNotiFicationForm.getSsVoyage() != null ? lclExportNotiFicationForm.getSsVoyage() : ""; pier = lclExportNotiFicationForm.getPier() != null ? lclExportNotiFicationForm.getPier() .substring(0, lclExportNotiFicationForm.getPier().indexOf("(")) : ""; pier = pier.replace("/", ", "); } else { vessel = CommonUtils.isNotEmpty(lclSsDetail.getSpReferenceName()) ? lclSsDetail.getSpReferenceName() : ""; portLrd = CommonUtils.isNotEmpty(lclSsDetail.getRelayLrdOverride()) ? lclSsDetail.getRelayLrdOverride().toString() : ""; sail_date = lclSsDetail.getStd() != null ? DateUtils.formatDate(lclSsDetail.getStd(), "MM/dd/yyyy") : ""; eta_date = lclSsDetail.getSta() != null ? DateUtils.formatDate(lclSsDetail.getSta(), "MM/dd/yyyy") : ""; ss_line = lclSsDetail.getSpAcctNo() != null ? lclSsDetail.getSpAcctNo().getAccountName() : ""; ss_voyage = lclSsDetail.getSpReferenceNo() != null ? lclSsDetail.getSpReferenceNo() : ""; pier = CommonUtils.isNotEmpty(lclExportNotiFicationForm.getPier()) ? lclExportNotiFicationForm .getPier().substring(0, lclExportNotiFicationForm.getPier().indexOf("(")) : ""; pier = lclSsDetail.getDeparture().getUnLocationName() + "," + stateValue; } table.addCell(allocateCell("Voy#...:" + lclSsDetail.getLclSsHeader().getScheduleNo(), true)); table.addCell(allocateCell("Voy#...:" + lclSsDetail.getLclSsHeader().getScheduleNo(), false)); table.addCell(allocateCell("Vessel Name..:" + vessel, true)); table.addCell(allocateCell("Vessel Name..:" + lclSsDetail.getSpReferenceName(), false)); table.addCell(allocateCell("Pier.........:" + pier, true)); String changedCity = lclSsDetail.getDeparture().getUnLocationName() + ", " + stateValue; table.addCell(allocateCell("Pier.........:" + changedCity, false)); String lrdOverride = null != lclSsDetail.getRelayLrdOverride() ? lclSsDetail.getRelayLrdOverride().toString() : ""; table.addCell(allocateCell("Port LRD ....:" + portLrd, true)); table.addCell(allocateCell("Port LRD ....:" + lrdOverride, false)); table.addCell(allocateCell("Sail Date....:" + sail_date, true)); table.addCell(allocateCell("Sail Date....:" + DateUtils.formatDate(lclSsDetail.getStd(), "MM/dd/yyyy"), false)); table.addCell(allocateCell("ETA POD Date :" + eta_date, true)); table.addCell(allocateCell("ETA POD Date :" + DateUtils.formatDate(lclSsDetail.getSta(), "MM/dd/yyyy"), false)); ETA_FD = lclSsDetail.getSta(); table.addCell(allocateCell("Line Name....:" + ss_line, true)); table.addCell(allocateCell("Line Name....:" + lclSsDetail.getSpAcctNo().getAccountName(), false)); table.addCell(allocateCell("SS Voyage#...:" + ss_voyage, true)); table.addCell(allocateCell("SS Voyage#...:" + lclSsDetail.getSpReferenceNo(), false)); table.addCell(allocateCell(" ", true)); table.addCell(allocateCell(" ", false)); } cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); cell.setBorderWidthTop(0.6f); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable containerBlock(String companyName, String portofDischarge, LclFileNumber fileNumber, LclExportNotiFicationForm lclExportNotiFicationForm) throws IOException, BadElementException, DocumentException, Exception { table = new PdfPTable(2); table.setWidths(new float[] { 5f, 5f }); table.setWidthPercentage(100f);//from www . ja v a2 s .co m Font fontArialBold = FontFactory.getFont("Courier", 10f, Font.BOLD); Font bigArialBold = FontFactory.getFont("Courier", 15f, Font.BOLD); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(9f, "Container# ", fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(9f, "ETA-FINAL DESTINATION", bigArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); String containerNo = new LclExportsVoyageNotificationDAO() .getAllContainerNoFormVoyage(lclExportNotiFicationForm.getHeaderId().toString()); p = new Paragraph(9f, "" + containerNo.replace(",", "\n"), fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); boolean isDrPicked = new ExportUnitQueryUtils().isPickedFile(fileNumber.getId()); if (isDrPicked) { p = new Paragraph(9f, DateUtils.formatDate(ETA_FD, "MM/dd/yyyy") + " " + portofDischarge, fontArialBold); } else { String eta_date = DateUtils.formatDate(fileNumber.getLclBooking().getFdEta(), "MM/dd/yyyy"); eta_date = eta_date != null ? eta_date : ""; p = new Paragraph(9f, eta_date + " " + portofDischarge, fontArialBold); } p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(4); p = new Paragraph(90f, " ", fontArialBold); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(2); cell.setColspan(4); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable reasonBlock(LclExportNotiFicationForm lclExportNotiFicationForm) throws IOException, BadElementException, DocumentException, Exception { User user = new UserDAO().findById( lclExportNotiFicationForm.getUserId() != null ? lclExportNotiFicationForm.getUserId().intValue() : 0);/*from w w w. j a va 2s.c om*/ String userName = user != null ? user.getFirstName() : ""; table = new PdfPTable(2); table.setWidthPercentage(100f); Font fontArialBold = FontFactory.getFont("Courier", 10f, Font.BOLD); Font fontArialNormal = FontFactory.getFont("Courier", 10f, Font.NORMAL); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); p = new Paragraph(9f, "Reason:", fontArialBold); cell.addElement(p); table.addCell(cell); String voyageChangeReason = CommonUtils.isNotEmpty(lclExportNotiFicationForm.getVoyageReason()) ? lclExportNotiFicationForm.getVoyageReason().toUpperCase() : ""; String voyageComment = CommonUtils.isNotEmpty(lclExportNotiFicationForm.getVoyageComment()) ? lclExportNotiFicationForm.getVoyageComment().toUpperCase() : ""; cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); p = new Paragraph(9f, "" + voyageChangeReason + "\n" + voyageComment, fontArialNormal); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); p = new Paragraph(20f, "Changes Made By:" + userName, fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); p = new Paragraph(20f, "Contact#", fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); p = new Paragraph(7f, null != user ? user.getTelephone() : "", fontArialNormal); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); String notes = ""; if ("preview".equalsIgnoreCase(lclExportNotiFicationForm.getNoticeStatus())) { notes = lclExportNotiFicationForm.getRemarks() != null ? lclExportNotiFicationForm.getRemarks().toUpperCase() : ""; } p = new Paragraph(7f, "Notes:", fontArialBold); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); p = new Paragraph(7f, " " + notes, fontArialNormal); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); p = new Paragraph(10f, " ", fontArialNormal); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(1); cell.setColspan(2); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable footerBlock() throws IOException, BadElementException, DocumentException, Exception { table = new PdfPTable(3); table.setWidthPercentage(100f);/*ww w .j a v a 2 s .co m*/ Font fontArialNormal = FontFactory.getFont("Courier", 10f, Font.NORMAL); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); p = new Paragraph(9f, "Date:" + DateUtils.formatDate(new Date(), "MM/dd/yyyy"), fontArialNormal); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); p = new Paragraph(9f, "End Of Report", fontArialNormal); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(0); p = new Paragraph(9f, "Time :" + new Date().getHours() + ":" + new Date().getMinutes(), fontArialNormal); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.hris.payroll.reports.AdvancesReportPdf.java
public AdvancesReportPdf(int branchId, Date payrollDate, String reportType) { this.branchId = branchId; this.payrollDate = payrollDate; this.reportType = reportType; Document document = null;/*from w w w. j a va 2 s. c o m*/ Rectangle pageSize = new Rectangle(318, 825); try { document = new Document(PageSize.A4.rotate(), 37, 37, 37, 37); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); int tradeId = cs.getTradeIdByBranchId(branchId); int corporateId = cs.getCorporateIdByTradeId(tradeId); Paragraph reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase(cs.getCorporateById(corporateId).toUpperCase(), header)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Trade: " + cs.getTradeById(tradeId).toUpperCase(), header)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Branch: " + cs.getBranchById(getBranchId()).toUpperCase(), header)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Advances Type: " + getReportType(), content)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Payroll Period: " + CommonUtil.changeDateFormat( ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()).getPayrollDate().toString()), content)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Cut-off Date: " + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()) .getAttendancePeriodFrom().toString()) + " - " + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()) .getAttendancePeriodTo().toString()), content)); document.add(reportHeader); document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(3); // table.setWidthPercentage(100); table.setTotalWidth(new float[] { 180, 120, 300 }); table.setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); PdfPCell cellLabel = new PdfPCell(); Paragraph parLabel = new Paragraph(); parLabel.add(new Phrase("EMPLOYEE", boldFont)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase("AMOUNT", boldFont)); parLabel.setAlignment(Element.ALIGN_RIGHT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase("PARTICULARS", boldFont)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setPaddingLeft(20); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); table.addCell(cellLabel); String middlename; double grandTotalAmount = 0; double subTotalAmount; int prCounter = 0; int advancesCounter; for (PayrollRegister pr : ps.findByBranch(getBranchId(), getPayrollDate())) { if (pr.getMiddlename().isEmpty() || pr.getMiddlename() == null) { middlename = ""; } else { middlename = pr.getMiddlename().toUpperCase(); } String employee = pr.getLastname().toUpperCase() + ", " + pr.getFirstname().toUpperCase() + " " + middlename; subTotalAmount = 0; advancesCounter = 0; for (Advances a : as.findByPayroll(pr.getPayrollId(), getReportType())) { cellLabel = new PdfPCell(); parLabel = new Paragraph(); if (advancesCounter == 0) { parLabel.add(new Phrase(employee, content)); } else { parLabel.add(new Phrase("", content)); } parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.NO_BORDER); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase(CommonUtil.formatNumValue(a.getAmount()), content)); parLabel.setAlignment(Element.ALIGN_RIGHT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); subTotalAmount = subTotalAmount + a.getAmount(); advancesCounter++; if (advancesCounter == as.findByPayroll(pr.getPayrollId(), getReportType()).size()) { cellLabel.setBorder(Rectangle.BOTTOM); } else { cellLabel.setBorder(Rectangle.NO_BORDER); } table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase(a.getParticulars(), content)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setPaddingLeft(20); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.NO_BORDER); table.addCell(cellLabel); } if (subTotalAmount != 0) { subTotal(table, subTotalAmount); } grandTotalAmount = grandTotalAmount + subTotalAmount; prCounter++; } grandTotal(table, grandTotalAmount); document.add(table); } catch (DocumentException ex) { Logger.getLogger(AdvancesReportPdf.class.getName()).log(Level.SEVERE, null, ex); } finally { document.close(); } }
From source file:com.hris.payroll.reports.AdvancesReportPdf.java
private void subTotal(PdfPTable table, double subTotalAmount) { PdfPCell cellLabel = new PdfPCell(); Paragraph parLabel = new Paragraph(); parLabel.add(new Phrase("", content)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel);//from w w w. j av a 2 s. com cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase( "SUB TOTAL: " + CommonUtil.formatNumValue(CommonUtil.roundOffToTwoDecimalPlaces(subTotalAmount)), content)); parLabel.setAlignment(Element.ALIGN_RIGHT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase("", content)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setPaddingLeft(20); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); }