List of usage examples for com.lowagie.text HeaderFooter HeaderFooter
public HeaderFooter(Phrase before, boolean numbered)
Header
-object with a pagenumber at the end. From source file:ispyb.client.mx.results.ExportAutoProcAction.java
License:Open Source License
/** * set footer in the specified document//from www . java2 s . co m * * @param document * @throws Exception */ private void setFooter(Document document) throws Exception { HeaderFooter footer = new HeaderFooter(new Phrase("Page n."), true); footer.setAlignment(Element.ALIGN_RIGHT); footer.setBorderWidth(1); footer.getBefore().getFont().setSize(PdfRtfExporter.SMALL_FONT); document.setFooter(footer); }
From source file:ispyb.common.util.export.ExiPdfRtfExporter.java
License:Open Source License
/** * sets the header in the specified document * /*from ww w . j a va 2s .c o m*/ * @param document * @throws Exception */ private void setHeader(Document document) throws Exception { HeaderFooter header; String h = "Data Collections for Proposal: " + proposalDesc; if (slv != null) { h += " on Beamline: " + (slv.getBeamlineName() == null ? "" : slv.getBeamlineName()) + " --- Session start date: " + (slv.getStartDate() == null ? "" : Formatter.formatDate(slv.getStartDate())); } header = new HeaderFooter(new Phrase(h, FONT_HELVETICA_10), false); header.setAlignment(Element.ALIGN_CENTER); header.setBorderWidth(1); header.getBefore().getFont().setSize(SIZE_FONT); document.setHeader(header); }
From source file:ispyb.common.util.export.PdfExporterSample.java
License:Open Source License
/** * Exports the file for viewSample for shipment * //from ww w . jav a2 s .c o m * @return * @throws Exception */ public ByteArrayOutputStream exportAsPdf() throws Exception { // create simple doc and write to a ByteArrayOutputStream Document document = new Document(PageSize.A4.rotate(), 20, 20, 20, 20); document.addTitle("exportSamplesView"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); HeaderFooter header; // header + footer if (viewName != null) header = new HeaderFooter(new Phrase("Samples for Proposal: " + proposalDesc + " --- " + viewName), false); else header = new HeaderFooter(new Phrase("Samples for Proposal: " + proposalDesc), false); header.setAlignment(Element.ALIGN_CENTER); header.setBorderWidth(1); header.getBefore().getFont().setSize(8); HeaderFooter footer = new HeaderFooter(new Phrase("Page n."), true); footer.setAlignment(Element.ALIGN_RIGHT); footer.setBorderWidth(1); footer.getBefore().getFont().setSize(6); document.setHeader(header); document.setFooter(footer); document.open(); if (aList.isEmpty()) { document.add(new Paragraph("There is no samples in this report")); document.close(); return baos; } // Create first table for samples int NumColumns = 19; PdfPTable table = new PdfPTable(NumColumns); int headerwidths[] = { 6, 6, 6, 6, 6, 4, 6, 4, 4, 4, 4, 4, 4, 8, 5, 5, 5, 10, 6 }; // percentage table.setWidths(headerwidths); table.setWidthPercentage(100); // percentage table.getDefaultCell().setPadding(3); table.getDefaultCell().setBorderWidth(1); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // header PdfPCell cell = new PdfPCell(); table.addCell(new Paragraph("Protein", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Sample name", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Smp code", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Dewar", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Container", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Loc. in cont.", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Space group", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Cell a", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Cell b", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Cell c", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Cell alpha", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Cell beta", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Cell gamma", new Font(Font.HELVETICA, 8))); cell = new PdfPCell(new Paragraph("Crystal comments", new Font(Font.HELVETICA, 8))); table.addCell(cell); table.addCell(new Paragraph("Already observed resol.", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Required resol.", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Min. resol.", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Sample comments", new Font(Font.HELVETICA, 8))); table.addCell(new Paragraph("Sample status", new Font(Font.HELVETICA, 8))); table.setHeaderRows(1); // this is the end of the table header table.getDefaultCell().setBorderWidth(1); DecimalFormat df1 = new DecimalFormat("#####0.0"); DecimalFormat df2 = new DecimalFormat("#####0.00"); Iterator it = aList.iterator(); int i = 1; String currentContainer = "next"; String nextContainer = "next"; while (it.hasNext()) { table.getDefaultCell().setGrayFill(0.99f); if (i % 2 == 1) { table.getDefaultCell().setGrayFill(0.9f); } BLSample3VO samplefv = (BLSample3VO) it.next(); LOG.debug("table of datacollections pdf " + samplefv.getBlSampleId()); if (samplefv.getContainerVO() != null && samplefv.getContainerVO().getCode() != null) nextContainer = samplefv.getContainerVO().getCode(); else nextContainer = "next"; // in the case of view sorted by dewar/container, we add a page break afetr each container if (sortView.equals("2") && !currentContainer.equals(nextContainer)) { document.add(table); table.deleteBodyRows(); document.newPage(); } if (samplefv.getCrystalVO().getProteinVO().getAcronym() != null) table.addCell(new Paragraph(samplefv.getCrystalVO().getProteinVO().getAcronym(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getName() != null) table.addCell(new Paragraph(samplefv.getName(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCode() != null) table.addCell(new Paragraph(samplefv.getCode(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getContainerVO() != null && samplefv.getContainerVO().getDewarVO() != null && samplefv.getContainerVO().getDewarVO().getCode() != null) table.addCell(new Paragraph(samplefv.getContainerVO().getDewarVO().getCode(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getContainerVO() != null && samplefv.getContainerVO().getCode() != null) { currentContainer = samplefv.getContainerVO().getCode(); table.addCell(new Paragraph(currentContainer, new Font(Font.HELVETICA, 8))); } else { currentContainer = "current"; table.addCell(""); } if (samplefv.getLocation() != null) table.addCell(new Paragraph(samplefv.getLocation(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getSpaceGroup() != null) table.addCell(new Paragraph(samplefv.getCrystalVO().getSpaceGroup(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getCellA() != null) table.addCell( new Paragraph(df1.format(samplefv.getCrystalVO().getCellA()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getCellB() != null) table.addCell( new Paragraph(df1.format(samplefv.getCrystalVO().getCellB()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getCellC() != null) table.addCell( new Paragraph(df1.format(samplefv.getCrystalVO().getCellC()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getCellAlpha() != null) table.addCell(new Paragraph(df1.format(samplefv.getCrystalVO().getCellAlpha()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getCellBeta() != null) table.addCell(new Paragraph(df1.format(samplefv.getCrystalVO().getCellBeta()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getCellGamma() != null) table.addCell(new Paragraph(df1.format(samplefv.getCrystalVO().getCellGamma()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getCrystalVO().getComments() != null) table.addCell(new Paragraph(samplefv.getCrystalVO().getComments(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getDiffractionPlanVO() != null && samplefv.getDiffractionPlanVO().getObservedResolution() != null) { table.addCell(new Paragraph(df2.format(samplefv.getDiffractionPlanVO().getObservedResolution()), new Font(Font.HELVETICA, 8))); } else if (samplefv.getCrystalVO().getDiffractionPlanVO() != null && samplefv.getCrystalVO().getDiffractionPlanVO().getObservedResolution() != null) table.addCell(new Paragraph( df2.format(samplefv.getCrystalVO().getDiffractionPlanVO().getObservedResolution()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getDiffractionPlanVO() != null && samplefv.getDiffractionPlanVO().getRequiredResolution() != null) { table.addCell(new Paragraph(df2.format(samplefv.getDiffractionPlanVO().getRequiredResolution()), new Font(Font.HELVETICA, 8))); } else if (samplefv.getCrystalVO().getDiffractionPlanVO() != null && samplefv.getCrystalVO().getDiffractionPlanVO().getRequiredResolution() != null) table.addCell(new Paragraph( df2.format(samplefv.getCrystalVO().getDiffractionPlanVO().getRequiredResolution()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getDiffractionPlanVO() != null && samplefv.getDiffractionPlanVO().getMinimalResolution() != null) { table.addCell(new Paragraph(df2.format(samplefv.getDiffractionPlanVO().getMinimalResolution()), new Font(Font.HELVETICA, 8))); } else if (samplefv.getCrystalVO().getDiffractionPlanVO() != null && samplefv.getCrystalVO().getDiffractionPlanVO().getMinimalResolution() != null) table.addCell(new Paragraph( df2.format(samplefv.getCrystalVO().getDiffractionPlanVO().getMinimalResolution()), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getComments() != null && samplefv.getComments() != "") table.addCell(new Paragraph(samplefv.getComments(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (samplefv.getBlSampleStatus() != null) table.addCell(new Paragraph(samplefv.getBlSampleStatus(), new Font(Font.HELVETICA, 8))); else table.addCell(""); if (i % 2 == 1) { table.getDefaultCell().setGrayFill(0.0f); } i++; } document.add(table); document.close(); return baos; }
From source file:jmemorize.core.io.PdfRtfBuilder.java
License:Open Source License
private static void export(Lesson lesson, int mode, File file) throws IOException { logger = Main.getLogger();//from w w w. j a v a2s .c o m FontFactory.registerDirectories(); // set up the fonts we will use to write the front and back of cards String frontFontName = Settings.loadFont(FontType.CARD_FRONT).getFont().getFamily(); frontFont = FontFactory.getFont(frontFontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); if (frontFont == null) { logger.warning("FontFactory returned null (front) font for: " + frontFontName); } String backFontName = Settings.loadFont(FontType.CARD_FLIP).getFont().getFamily(); backFont = FontFactory.getFont(backFontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); if (backFont == null) { logger.warning("FontFactory returned null (back) font for: " + backFontName); } try { Document doc = new Document(); OutputStream out = new FileOutputStream(file); switch (mode) { case PDF_MODE: PdfWriter.getInstance(doc, out); break; case RTF_MODE: RtfWriter2.getInstance(doc, out); break; } doc.setHeader(new HeaderFooter(new Phrase(file.getName()), false)); doc.open(); // add cards in subtrees List<Category> subtree = lesson.getRootCategory().getSubtreeList(); for (Category category : subtree) { writeCategory(doc, category); } doc.close(); } catch (Throwable t) { throw (IOException) new IOException("Could not export to PDF").initCause(t); } }
From source file:net.bull.javamelody.internal.web.pdf.PdfDocumentFactory.java
License:Apache License
private void createWriter(Document document, String title) throws DocumentException, IOException { final PdfWriter writer = PdfWriter.getInstance(document, output); //writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft); // title/*from ww w . jav a 2 s .c o m*/ final HeaderFooter header = new HeaderFooter(new Phrase(title), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); // simple page numbers : x //HeaderFooter footer = new HeaderFooter(new Phrase(), true); //footer.setAlignment(Element.ALIGN_RIGHT); //footer.setBorder(Rectangle.TOP); //document.setFooter(footer); // add the event handler for advanced page numbers : x/y writer.setPageEvent(new PdfAdvancedPageNumberEvents()); }
From source file:net.bull.javamelody.swing.print.MPdfWriter.java
License:Apache License
/** * We create a writer that listens to the document and directs a PDF-stream to out * * @param table//from w w w . ja v a 2s . com * MBasicTable * @param document * Document * @param out * OutputStream * @return DocWriter * @throws DocumentException * e */ protected DocWriter createWriter(final MBasicTable table, final Document document, final OutputStream out) throws DocumentException { final PdfWriter writer = PdfWriter.getInstance(document, out); // writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft); // title if (table.getName() != null) { final HeaderFooter header = new HeaderFooter(new Phrase(table.getName()), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); document.addTitle(table.getName()); } // simple page numbers : x // HeaderFooter footer = new HeaderFooter(new Phrase(), true); // footer.setAlignment(Element.ALIGN_RIGHT); // footer.setBorder(Rectangle.TOP); // document.setFooter(footer); // add the event handler for advanced page numbers : x/y writer.setPageEvent(new AdvancedPageNumberEvents()); return writer; }
From source file:open.dolphin.client.AuditController.java
License:Open Source License
private void makePDF() { //- ?//from w w w . ja v a 2 s .c o m Document doc = new Document(PageSize.A4, 20.0F, 20.0F, 40.0F, 40.0F); try { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); String fileName = "_" + sdf.format(new java.util.Date()) + ".pdf"; //()?? FileOutputStream fos = new FileOutputStream(outputDir.getText() + fileName); PdfWriter pdfwriter = PdfWriter.getInstance(doc, fos); Font font_header = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 15.0F, 1); Font font_g11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F); Font font_g10 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 10.0F); //- ? Font font_m8 = new Font(BaseFont.createFont("HeiseiMin-W3", "UniJIS-UCS2-HW-H", false), 8.0F); Font font_underline_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F, 4); Font font_red_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F); font_red_11.setColor(new Color(255, 0, 0)); Font font_empty = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 9.0F); font_empty.setColor(new Color(255, 255, 255)); Paragraph para_NF = new Paragraph(5, "\r\n", new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 13, Font.NORMAL)); para_NF.setAlignment(Element.ALIGN_CENTER); // ?? String author = Project.getProjectStub().getUserModel().getCommonName(); doc.addAuthor(author); doc.addSubject(""); HeaderFooter header = new HeaderFooter(new Phrase("", font_header), false); header.setAlignment(1); doc.setHeader(header); HeaderFooter footer = new HeaderFooter(new Phrase("--"), new Phrase("--")); footer.setAlignment(1); footer.setBorder(0); doc.setFooter(footer); doc.open(); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy''MM''dd'' HH''mm''"); String today = sdf1.format(new java.util.Date()); Paragraph para_0 = new Paragraph("?" + today, font_g11); para_0.setAlignment(2); doc.add(para_0); Paragraph para_1 = new Paragraph("?" + author, font_g11); para_1.setAlignment(2); doc.add(para_1); doc.add(new Paragraph("")); // doc.add(para_NF); doc.add(para_NF); for (int cnt = 0; cnt < outputList.size(); cnt++) { InnerBean bean = outputList.get(cnt); Person person = bean.getPerson(); Paragraph para_2 = new Paragraph("ID" + person.idProperty().get(), font_underline_11); para_2.setAlignment(0); doc.add(para_2); Paragraph para_3 = new Paragraph("???" + person.nameProperty().get(), font_underline_11); para_3.setAlignment(0); doc.add(para_3); Paragraph para_4 = new Paragraph("" + person.nameKanaProperty().get(), font_underline_11); para_4.setAlignment(0); doc.add(para_4); Paragraph para_5 = new Paragraph("" + person.sexProperty().get(), font_underline_11); para_5.setAlignment(0); doc.add(para_5); Paragraph para_6 = new Paragraph("" + person.birthdayProperty().get(), font_underline_11); para_6.setAlignment(0); doc.add(para_6); Table karteHistoryTable = new Table(5); karteHistoryTable.setWidth(100.0F); int[] uriage_table_width = { 25, 20, 30, 20, 25 }; karteHistoryTable.setWidths(uriage_table_width); //karteHistoryTable.setDefaultHorizontalAlignment(1); //karteHistoryTable.setDefaultVerticalAlignment(5); karteHistoryTable.setPadding(3.0F); karteHistoryTable.setSpacing(0.0F); karteHistoryTable.setBorderColor(new Color(0, 0, 0)); Cell cell_01 = new Cell(new Phrase("?", font_g10)); cell_01.setGrayFill(0.8F); cell_01.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_11 = new Cell(new Phrase("?", font_g10)); cell_11.setGrayFill(0.8F); cell_11.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_21 = new Cell(new Phrase("", font_g10)); cell_21.setGrayFill(0.8F); cell_21.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_31 = new Cell(new Phrase("", font_g10)); cell_31.setGrayFill(0.8F); cell_31.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_41 = new Cell(new Phrase("", font_g10)); cell_41.setGrayFill(0.8F); cell_41.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell_01); karteHistoryTable.addCell(cell_11); karteHistoryTable.addCell(cell_21); karteHistoryTable.addCell(cell_31); karteHistoryTable.addCell(cell_41); List<KarteBean> list = bean.getResult(); KarteBean karteInfo = list.get(0); List<DocInfoModel> docInfoList = karteInfo.getDocInfoList(); //- ??? int stepCount = 22; int tempCount = 0; int pageCount = 0; String firstKarteMaker = null; String karteMakeDate = null; if (docInfoList != null) { for (int i = 0; i < docInfoList.size(); ++i) { DocInfoModel docInfo = docInfoList.get(i); Cell cell = new Cell(new Phrase(docInfo.getFirstConfirmDateTime(), font_m8)); if (karteMakeDate == null || !karteMakeDate.equals(docInfo.getFirstConfirmDateTime())) { karteMakeDate = docInfo.getFirstConfirmDateTime(); firstKarteMaker = docInfo.getPurpose(); } cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(firstKarteMaker, font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); //- String addTitle = docInfo.getTitle(); addTitle = addTitle.replace("\r\n", ""); addTitle = addTitle.replace("\n", ""); cell = new Cell(new Phrase(addTitle, font_m8)); cell.setHorizontalAlignment(0); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(docInfo.getPurpose(), font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(docInfo.getConfirmDateTime(), font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); if (stepCount == tempCount) { if (pageCount == 0) { stepCount += 5; pageCount++; } tempCount = 0; doc.add(karteHistoryTable); doc.newPage(); karteHistoryTable.deleteAllRows(); karteHistoryTable.addCell(cell_01); karteHistoryTable.addCell(cell_11); karteHistoryTable.addCell(cell_21); karteHistoryTable.addCell(cell_31); karteHistoryTable.addCell(cell_41); } else { tempCount++; } } // Cell Empty_Cell = new Cell(new Phrase("empty", font_empty)); // for (int i = docInfoList.size(); i < docInfoList.size() + 4; ++i) { // for (int j = 0; j < 4; ++j) { // karteHistoryTable.addCell(Empty_Cell); // } // } // // Cell cell_goukei = new Cell(new Phrase("?", font_g10)); // cell_goukei.setGrayFill(0.8F); // cell_goukei.setColspan(3); // karteHistoryTable.addCell(cell_goukei); // Cell cell_sum = new Cell(new Phrase("136,900", font_m10)); // cell_sum.setHorizontalAlignment(2); // karteHistoryTable.addCell(cell_sum); doc.add(karteHistoryTable); doc.newPage(); } else { // doc.add(para_NF); Paragraph noData = new Paragraph("??", font_m8); noData.setAlignment(0); doc.add(noData); doc.newPage(); } } } catch (DocumentException | IOException e) { Logger.getLogger(AuditController.class.getName()).log(Level.SEVERE, null, e); } finally { doc.close(); } }
From source file:org.activityinfo.server.report.renderer.itext.PdfReportRenderer.java
License:Open Source License
@Override protected void renderFooter(Document document) { HeaderFooter footer = new HeaderFooter(new Phrase("Page ", ThemeHelper.footerFont()), true); document.setFooter(footer);//from www . j a va 2 s. c om }
From source file:org.activityinfo.server.report.renderer.itext.RtfReportRenderer.java
License:Open Source License
@Override protected void renderFooter(Document document) { HeaderFooter footer = new HeaderFooter(new Phrase("Page", ThemeHelper.footerFont()), true); document.setFooter(footer);//from ww w . j av a2 s . com }
From source file:org.displaytag.export.PdfView.java
License:Artistic License
/** * @see org.displaytag.export.BinaryExportView#doExport(OutputStream) */// w ww . ja va2 s . c om public void doExport(OutputStream out) throws JspException { try { // Initialize the table with the appropriate number of columns initTable(); // Initialize the Document and register it with PdfWriter listener and the OutputStream Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40); document.addCreationDate(); HeaderFooter footer = new HeaderFooter(new Phrase(TagConstants.EMPTY_STRING, smallFont), true); footer.setBorder(Rectangle.NO_BORDER); footer.setAlignment(Element.ALIGN_CENTER); PdfWriter.getInstance(document, out); // Fill the virtual PDF table with the necessary data generatePDFTable(); document.open(); document.setFooter(footer); document.add(this.tablePDF); document.close(); } catch (Exception e) { throw new PdfGenerationException(e); } }