List of usage examples for com.itextpdf.text.pdf PdfPTable setSpacingBefore
public void setSpacingBefore(final float spacing)
From source file:org.inspira.condominio.pdf.DocumentoEstadoDeCuenta.java
private void agregaTablaDePagos() throws DocumentException { PdfPTable t1 = new PdfPTable(9); float total = setTableHeading(t1, pagos); PdfPCell cTotal = new PdfPCell(new Phrase("Total", F_NORMAL)); cTotal.setColspan(6);// w ww. ja va 2s . c om cTotal.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); t1.addCell(cTotal); Phrase phrase = new Phrase(String.valueOf(total).concat(" pesos"), F_NORMAL); PdfPCell cMontoTotal = new PdfPCell(); cMontoTotal.setColspan(3); cMontoTotal.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cMontoTotal.setPhrase(phrase); t1.addCell(cMontoTotal); t1.setSpacingBefore(20); documento.add(t1); }
From source file:org.inspira.condominio.pdf.DocumentoEstadoDeCuenta.java
private void agregaTablaDeAdeudos() throws DocumentException { PdfPTable t1 = new PdfPTable(9); float total = setTableHeading(t1, adeudos); PdfPCell cInteresMoratorioLegal = new PdfPCell(new Phrase("Inters moratorio legal")); cInteresMoratorioLegal.setColspan(3); t1.addCell(cInteresMoratorioLegal);/* w w w. j av a 2 s .c om*/ PdfPCell cFechaIML = new PdfPCell(new Paragraph("---")); cFechaIML.setColspan(3); cFechaIML.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); t1.addCell(cFechaIML); PdfPCell cMontoIML = new PdfPCell( new Paragraph(String.format("%.2f pesos", total * INTERES_MORATORIO_LEGAL))); cMontoIML.setColspan(3); cMontoIML.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cMontoIML.setVerticalAlignment(PdfPCell.ALIGN_CENTER); t1.addCell(cMontoIML); PdfPCell cSancionesEstablecidasPorAsamblea = new PdfPCell( new Paragraph("Sanciones establecidas por asamblea")); cSancionesEstablecidasPorAsamblea.setColspan(3); t1.addCell(cSancionesEstablecidasPorAsamblea); PdfPCell cFechaSEA = new PdfPCell(new Paragraph("---")); cFechaSEA.setColspan(3); cFechaSEA.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cFechaSEA.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cFechaSEA.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); t1.addCell(cFechaSEA); PdfPCell cMontoSEA = new PdfPCell(new Paragraph(String.format("%.2f pesos", total * porcentajeSanciones))); cMontoSEA.setColspan(3); cMontoSEA.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cMontoSEA.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); t1.addCell(cMontoSEA); total *= INTERES_MORATORIO_LEGAL + porcentajeSanciones; PdfPCell cTotal = new PdfPCell(new Phrase("Total", F_NORMAL)); cTotal.setColspan(6); cTotal.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); t1.addCell(cTotal); PdfPCell cMontoTotal = new PdfPCell(new Phrase(String.format("%.2f pesos", total), F_NORMAL)); cMontoTotal.setColspan(3); cMontoTotal.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); t1.addCell(cMontoTotal); t1.setSpacingBefore(20f); t1.setSpacingAfter(12f); documento.add(t1); }
From source file:org.inspira.condominio.pdf.DocumentoIngreso.java
private float addTablaFormatoIngresos(InformacionIngresos infoIngresos) throws DocumentException { PdfPCell cellHeader1 = new PdfPCell(new Phrase("Ingresos Ordinarios", F_CELL_HEADER_TEXT)); cellHeader1.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellHeader1.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader1.setColspan(5);/*from w w w . j a v a 2 s. c om*/ cellHeader1.setFixedHeight(20f); cellHeader1.setBackgroundColor(new BaseColor(0xff009846)); PdfPCell cellHeader2 = new PdfPCell(new Phrase("Monto", F_CELL_HEADER_TEXT)); cellHeader2.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellHeader2.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader2.setColspan(5); cellHeader2.setBackgroundColor(new BaseColor(0xff009846)); cellHeader2.setFixedHeight(20f); PdfPCell cellHeader3 = new PdfPCell(new Phrase("En cuenta bancaria", F_NORMAL)); cellHeader3.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cellHeader3.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader3.setColspan(5); cellHeader3.setFixedHeight(20f); PdfPCell cellHeader4 = new PdfPCell( new Phrase(String.format("%.2f pesos", infoIngresos.getMontoCuentaBancaria()), F_NORMAL)); cellHeader4.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellHeader4.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader4.setColspan(5); cellHeader4.setFixedHeight(20f); PdfPCell cellHeader5 = new PdfPCell(new Phrase("En caja de administracin", F_NORMAL)); cellHeader5.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cellHeader5.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader5.setColspan(5); cellHeader5.setFixedHeight(20f); PdfPCell cellHeader6 = new PdfPCell( new Phrase(String.format("%.2f pesos", infoIngresos.getMontoEnCajaDeAdministracion()), F_NORMAL)); cellHeader6.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellHeader6.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader6.setColspan(5); cellHeader6.setFixedHeight(20f); PdfPCell cellHeader7 = new PdfPCell(new Phrase("Total", F_NORMAL)); cellHeader7.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cellHeader7.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader7.setColspan(5); cellHeader7.setFixedHeight(20f); PdfPCell cellHeader8 = new PdfPCell(new Phrase( String.format("%.2f pesos", infoIngresos.getMontoCuentaBancaria() + infoIngresos.getMontoEnCajaDeAdministracion()), F_NORMAL)); cellHeader8.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellHeader8.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellHeader8.setColspan(5); cellHeader8.setFixedHeight(20f); PdfPTable table = new PdfPTable(10); table.setWidthPercentage(100); table.addCell(cellHeader1); table.addCell(cellHeader2); table.addCell(cellHeader3); table.addCell(cellHeader4); table.addCell(cellHeader5); table.addCell(cellHeader6); table.addCell(cellHeader7); table.addCell(cellHeader8); table.setSpacingBefore(3f); documento.add(table); return infoIngresos.getMontoCuentaBancaria() + infoIngresos.getMontoEnCajaDeAdministracion(); }
From source file:org.openlmis.web.view.pdf.requisition.RequisitionPdfModel.java
License:Open Source License
private PdfPTable prepareTable(List<? extends Column> visibleColumns) throws DocumentException { java.util.List<Integer> widths = new ArrayList<>(); for (Column column : visibleColumns) { widths.add(column.getColumnWidth()); }// w ww.j a va 2 s.c o m PdfPTable table = new PdfPTable(widths.size()); table.setWidths(ArrayUtils.toPrimitive(widths.toArray(new Integer[widths.size()]))); table.getDefaultCell().setBackgroundColor(HEADER_BACKGROUND); table.getDefaultCell().setPadding(CELL_PADDING); table.setWidthPercentage(WIDTH_PERCENTAGE); table.setSpacingBefore(TABLE_SPACING); table.setHeaderRows(2); table.setFooterRows(1); setTableHeader(table, visibleColumns); setBlankFooter(table, visibleColumns.size()); return table; }
From source file:org.openlmis.web.view.pdf.requisition.RequisitionPdfModel.java
License:Open Source License
private PdfPTable prepareRequisitionHeaderTable() throws DocumentException { int[] columnWidths = { 160, 160, 160, 160, 160 }; PdfPTable table = new PdfPTable(columnWidths.length); table.setWidths(columnWidths);//w w w . ja v a2 s . co m table.getDefaultCell().setBackgroundColor(HEADER_BACKGROUND); table.getDefaultCell().setPadding(10); table.getDefaultCell().setBorder(0); table.setWidthPercentage(WIDTH_PERCENTAGE); table.setSpacingBefore(TABLE_SPACING); table.setHeaderRows(1); return table; }
From source file:org.openlmis.web.view.pdf.requisition.RequisitionPdfModel.java
License:Open Source License
public PdfPTable getSummary() throws DocumentException { this.requisition.fillFullSupplyCost(); this.requisition.fillNonFullSupplyCost(); DecimalFormat formatter = new DecimalFormat("#,##0.00"); PdfPTable summaryTable = new PdfPTable(2); summaryTable.setWidths(new int[] { 30, 20 }); summaryTable.setSpacingBefore(TABLE_SPACING); summaryTable.setWidthPercentage(40); summaryTable.setHorizontalAlignment(0); PdfPCell summaryHeaderCell = headingCell(messageService.message("label.summary")); summaryHeaderCell.setColspan(2);/* ww w . java 2 s . co m*/ summaryHeaderCell.setPadding(10); summaryHeaderCell.setBorder(0); summaryTable.addCell(summaryHeaderCell); boolean showBudget = !requisition.isEmergency() && requisition.getProgram().getBudgetingApplies(); if (showBudget) { summaryTable.addCell(summaryCell(textCell(messageService.message("label.allocated.budget")))); PdfPCell allocatedBudgetCell = requisition.getAllocatedBudget() != null ? numberCell(messageService.message(LABEL_CURRENCY_SYMBOL) + formatter.format(new Money(requisition.getAllocatedBudget()).toDecimal())) : numberCell(messageService.message("msg.budget.not.allocated")); summaryTable.addCell(summaryCell(allocatedBudgetCell)); } summaryTable.addCell(summaryCell(textCell(messageService.message("label.total.cost.full.supply.items")))); summaryTable.addCell(summaryCell(numberCell(messageService.message(LABEL_CURRENCY_SYMBOL) + formatter.format(requisition.getFullSupplyItemsSubmittedCost().toDecimal())))); summaryTable .addCell(summaryCell(textCell(messageService.message("label.total.cost.non.full.supply.items")))); summaryTable.addCell(summaryCell(numberCell(messageService.message(LABEL_CURRENCY_SYMBOL) + formatter.format(requisition.getNonFullSupplyItemsSubmittedCost().toDecimal())))); summaryTable.addCell(summaryCell(textCell(messageService.message("label.total.cost")))); summaryTable.addCell(summaryCell(numberCell(messageService.message(LABEL_CURRENCY_SYMBOL) + formatter.format(this.getTotalCost(requisition).toDecimal()).toString()))); if (showBudget && requisition.getAllocatedBudget() != null && (requisition.getAllocatedBudget().compareTo(this.getTotalCost(requisition).getValue()) == -1)) { summaryTable.addCell(summaryCell(textCell(messageService.message("msg.cost.exceeds.budget")))); summaryTable.addCell(summaryCell(textCell(" "))); } summaryTable.addCell(summaryCell(textCell(" "))); summaryTable.addCell(summaryCell(textCell(" "))); summaryTable.addCell(summaryCell(textCell(" "))); summaryTable.addCell(summaryCell(textCell(" "))); fillAuditFields(summaryTable); return summaryTable; }
From source file:org.sakaiproject.attendance.export.PDFEventExporterImpl.java
License:Educational Community License
private PdfPTable signInSheetTable() { PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100);/* w w w. j a v a2s .c om*/ table.setSpacingBefore(12); PdfPCell nameHeader = new PdfPCell(new Paragraph("Student Name", tableHeader)); nameHeader.setPadding(10); PdfPCell signatureHeader = new PdfPCell(new Paragraph("Signature", tableHeader)); signatureHeader.setPadding(10); table.addCell(nameHeader); table.addCell(signatureHeader); Collections.sort(users, new SortNameUserComparator()); for (User user : users) { PdfPCell userCell = new PdfPCell(new Paragraph(user.getSortName(), body)); userCell.setPadding(10); PdfPCell blankCell = new PdfPCell(new Paragraph()); blankCell.setPadding(10); table.addCell(userCell); table.addCell(blankCell); } return table; }
From source file:org.sakaiproject.attendance.export.PDFEventExporterImpl.java
License:Educational Community License
private PdfPTable attendanceSheetTable() { List<AttendanceStatus> activeStatuses = attendanceLogic.getActiveStatusesForSite(event.getAttendanceSite()); int colSpan = activeStatuses.size() - 1; if (colSpan <= 0) { colSpan = 1;//from www . j a v a 2 s . c o m } PdfPTable table = new PdfPTable(colSpan * 2); table.setWidthPercentage(100); table.setSpacingBefore(12); PdfPCell nameHeader = new PdfPCell(new Paragraph("Student Name", tableHeader)); nameHeader.setPadding(10); nameHeader.setColspan(colSpan); table.addCell(nameHeader); int numStatusHeaders = 0; for (AttendanceStatus status : activeStatuses) { if (status.getStatus() != Status.UNKNOWN) { Paragraph statusHeaderParagraph = new Paragraph(getStatusString(status.getStatus(), colSpan), tableHeader); statusHeaderParagraph.setAlignment(Element.ALIGN_CENTER); PdfPCell statusHeader = new PdfPCell(statusHeaderParagraph); statusHeader.setPadding(10); table.addCell(statusHeader); numStatusHeaders++; } } if (numStatusHeaders == 0) { Paragraph statusHeaderParagraph = new Paragraph("Status", tableHeader); statusHeaderParagraph.setAlignment(Element.ALIGN_CENTER); PdfPCell statusHeader = new PdfPCell(statusHeaderParagraph); statusHeader.setPadding(10); table.addCell(statusHeader); } Collections.sort(users, new SortNameUserComparator()); for (User user : users) { PdfPCell userCell = new PdfPCell( new Paragraph(user.getSortName() + " (" + user.getDisplayId() + ")", body)); userCell.setPadding(10); userCell.setColspan(colSpan); table.addCell(userCell); for (int i = 0; i < colSpan; i++) { // Add blank cell table.addCell(new PdfPCell(new Paragraph())); } } return table; }
From source file:org.smap.sdal.managers.PDFSurveyManager.java
License:Open Source License
private void processForm(Parser parser, Document document, ArrayList<Result> record, String basePath, String serverRoot, boolean generateBlank, int depth, int length, int[] repIndexes, GlobalVariables gv, boolean appendix, ArrayList<ArrayList<Result>> parentRecords, String remoteUser, int oId) throws DocumentException, IOException, SQLException { // Check that the depth of repeats hasn't exceeded the maximum if (depth > repIndexes.length - 1) { depth = repIndexes.length - 1;/*from www . j a v a 2s . com*/ } boolean firstQuestion = true; for (int j = 0; j < record.size(); j++) { Result r = record.get(j); if (r.type.equals("form")) { firstQuestion = true; // Make sure there is a gap when we return from the sub form // If this is a blank template check to see the number of times we should repeat this sub form if (generateBlank) { int blankRepeats = getBlankRepeats(r.appearance); for (int k = 0; k < blankRepeats; k++) { repIndexes[depth] = k; processForm(parser, document, r.subForm.get(0), basePath, serverRoot, generateBlank, depth + 1, k, repIndexes, gv, appendix, null, remoteUser, oId); } } else { for (int k = 0; k < r.subForm.size(); k++) { // Maintain array list of parent records in order to look up ${values} parentRecords.add(0, record); // Push this record in at the beginning of the list as we want to search most recent first repIndexes[depth] = k; processForm(parser, document, r.subForm.get(k), basePath, serverRoot, generateBlank, depth + 1, k, repIndexes, gv, appendix, parentRecords, remoteUser, oId); } } } else { // Process the question Form form = survey.forms.get(r.fIdx); Question question = getQuestionFromResult(sd, r, form); if (question != null) { if (includeResult(r, question, appendix, gv, generateBlank)) { if (question.type.equals("begin group")) { if (question.isNewPage()) { document.newPage(); } } else if (question.type.equals("end group")) { //ignore } else { Row row = prepareRow(record, survey, j, gv, length, appendix, parentRecords, generateBlank); PdfPTable newTable = processRow(parser, row, basePath, serverRoot, generateBlank, depth, repIndexes, gv, remoteUser, oId); newTable.setWidthPercentage(100); newTable.setKeepTogether(true); // Add a gap if this is the first question of the record // or the previous row was at a different depth if (firstQuestion) { newTable.setSpacingBefore(5); } else { newTable.setSpacingBefore(row.spaceBefore()); } firstQuestion = false; // Start a new page if the first question needs to be on a new page if (row.items.get(0).isNewPage) { document.newPage(); } document.add(newTable); j += row.items.size() - 1; // Jump over multiple questions if more than one was added to the row } } } else { log.info("Question Idx not found: " + r.qIdx); } } } return; }
From source file:org.spinsuite.print.ReportPrintData.java
License:Open Source License
/** * Create a PDF File/*w ww . j a va2 s . c o m*/ * @author Yamel Senih, ysenih@erpcya.com, ERPCyA http://www.erpcya.com 02/04/2014, 22:52:09 * @param outFile * @throws FileNotFoundException * @throws DocumentException * @return void */ private void createPDF(File outFile) throws FileNotFoundException, DocumentException { Document document = new Document(PageSize.LETTER); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outFile)); PDFHeaderAndFooter event = new PDFHeaderAndFooter(); writer.setPageEvent(event); document.open(); // document.addAuthor(ctx.getResources().getString(R.string.app_name)); document.addCreationDate(); // Paragraph title = new Paragraph(m_reportQuery.getInfoReport().getName()); // Set Font title.getFont().setStyle(Font.BOLD); // Set Alignment title.setAlignment(Paragraph.ALIGN_CENTER); // Add Title document.add(title); // Add New Line document.add(Chunk.NEWLINE); // Parameters ProcessInfoParameter[] param = m_pi.getParameter(); // Get Parameter if (param != null) { // boolean isFirst = true; // Iterate for (ProcessInfoParameter para : param) { // Get SQL Name String name = para.getInfo(); StringBuffer textParameter = new StringBuffer(); if (para.getParameter() == null && para.getParameter_To() == null) continue; else { // Add Parameters Title if (isFirst) { Paragraph titleParam = new Paragraph( ctx.getResources().getString(R.string.msg_ReportParameters)); // Set Font titleParam.getFont().setStyle(Font.BOLDITALIC); // Add to Document document.add(titleParam); isFirst = false; } // Add Parameters Name if (para.getParameter() != null && para.getParameter_To() != null) { // From and To is filled // textParameter.append(name).append(" => ").append(para.getDisplayValue()).append(" <= ") .append(para.getDisplayValue_To()); } else if (para.getParameter() != null) { // Only From // textParameter.append(name).append(" = ").append(para.getDisplayValue()); } else if (para.getParameter_To() != null) { // Only To // textParameter.append(name).append(" <= ").append(para.getDisplayValue_To()); } } // Add to Document Paragraph viewParam = new Paragraph(textParameter.toString()); document.add(viewParam); } } document.add(Chunk.NEWLINE); // InfoReportField[] columns = m_reportQuery.getColumns(); // Add Table PdfPTable table = new PdfPTable(columns.length); table.setSpacingBefore(4); // Add Header PdfPCell headerCell = new PdfPCell(new Phrase(m_reportQuery.getInfoReport().getName())); headerCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); headerCell.setColspan(columns.length); // Add to Table table.addCell(headerCell); // Add Header // Decimal and Date Format DecimalFormat[] cDecimalFormat = new DecimalFormat[columns.length]; SimpleDateFormat[] cDateFormat = new SimpleDateFormat[columns.length]; for (int i = 0; i < columns.length; i++) { InfoReportField column = columns[i]; // Only Numeric if (DisplayType.isNumeric(column.DisplayType)) cDecimalFormat[i] = DisplayType.getNumberFormat(ctx, column.DisplayType, column.FormatPattern); // Only Date else if (DisplayType.isDate(column.DisplayType)) cDateFormat[i] = DisplayType.getDateFormat(ctx, column.DisplayType, column.FormatPattern); // Phrase phrase = new Phrase(column.PrintName); PdfPCell cell = new PdfPCell(phrase); if (column.FieldAlignmentType.equals(InfoReportField.FIELD_ALIGNMENT_TYPE_TRAILING_RIGHT)) cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); else if (column.FieldAlignmentType.equals(InfoReportField.FIELD_ALIGNMENT_TYPE_CENTER)) cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); else cell.setHorizontalAlignment(PdfPCell.ALIGN_UNDEFINED); // table.addCell(cell); } // Add Detail for (int row = 0; row < m_data.size(); row++) { // Get Row RowPrintData rPrintData = m_data.get(row); // Iterate for (int col = 0; col < columns.length; col++) { InfoReportField column = columns[col]; ColumnPrintData cPrintData = rPrintData.get(col); Phrase phrase = null; PdfPCell cell = new PdfPCell(); // String value = cPrintData.getValue(); // Only Values if (value != null) { if (DisplayType.isNumeric(column.DisplayType)) { // Number // Format DecimalFormat decimalFormat = cDecimalFormat[col]; // Format if (decimalFormat != null) value = decimalFormat.format(DisplayType.getNumber(value)); // Set Value cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); } else if (DisplayType.isDate(column.DisplayType)) { // Is Date SimpleDateFormat dateFormat = cDateFormat[col]; if (dateFormat != null && value.trim().length() > 0) { long date = Long.parseLong(value); value = dateFormat.format(new Date(date)); } } } // Set Value phrase = new Phrase(value); // if (column.FieldAlignmentType.equals(InfoReportField.FIELD_ALIGNMENT_TYPE_TRAILING_RIGHT)) cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); else if (column.FieldAlignmentType.equals(InfoReportField.FIELD_ALIGNMENT_TYPE_CENTER)) cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); else cell.setHorizontalAlignment(PdfPCell.ALIGN_UNDEFINED); // Set Font if (rPrintData.isFunctionRow()) { // Set Function Value if (cPrintData.getFunctionValue() != null && cPrintData.getFunctionValue().length() > 0) phrase = new Phrase(cPrintData.getFunctionValue()); // Set Font phrase.getFont().setStyle(Font.BOLDITALIC); } // Add to Table cell.setPhrase(phrase); table.addCell(cell); } } // Add Table to Document document.add(table); // New Line document.add(Chunk.NEWLINE); // Add Footer StringBuffer footerText = new StringBuffer(Env.getContext("#SUser")); footerText.append("("); footerText.append(Env.getContext("#AD_Role_Name")); footerText.append("@"); footerText.append(Env.getContext("#AD_Client_Name")); footerText.append("."); footerText.append(Env.getContext("#AD_Org_Name")); footerText.append("{").append(Build.MANUFACTURER).append(".").append(Build.MODEL).append("}) "); // Date SimpleDateFormat pattern = DisplayType.getDateFormat(ctx, DisplayType.DATE_TIME); footerText.append(" ").append(ctx.getResources().getString(R.string.Date)).append(" = "); footerText.append(pattern.format(new Date())); // Paragraph footer = new Paragraph(footerText.toString()); footer.setAlignment(Paragraph.ALIGN_CENTER); // Set Font footer.getFont().setSize(8); // Add Footer document.add(footer); // Close Document document.close(); }