Lajara Daniel wrote: > Hello. > > I have a problem creating a PDF. > Without a footer, I can insert a PdfPTable with their margins and all works > OK. > But now I want to insert a Footer with page number.
Using page events I presume. > I can do that but somewhere I got a space between PDFPTable and the footer. So? > I have changed the setSpacingBefore() and setSpacingAfter() method in > PDFPTable, but it seems not work. I don't understand the question. Of course there can be some spacing between content added with document.add() and text added with showTextAligned() in a page event. > I have checked that this space is diferent between Header and PDFPTable. > Is there somewhere to put to '0' this space? You've lost me. Sorry for the short explanation. I try to explain. I have created a PDF using: com.lowagie.text.Rectangle pageDim = PageSize.A4.rotate(); com.lowagie.text.Document document = new com.lowagie.text.Document(pageDim); document.setMargins(42,42,42,42); String fileDocument = "C:\\test.pdf";//Path of PDF PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileDocument)); document.open(); //Here we get some information from Object and create the PDFPTable with their PdfPCell. p.e. PdfPTable tableData = new PdfPTable(5); tableData.addCell(new PdfPCell(tableHead));//tableHead have the information. And we insert more rows. //At the end of the page, we insert a extended cell PdfPCell cellExpand = new PdfPCell(); tableData.setWidthPercentage(100); cellExpand.setColspan(5); tableData.setSpacingAfter(0); tableData.setSpacingBefore(0); tableData.addCell(cellExpand); //and we insert the table in the document document.add(tableData); //After that we close the document and all works fine if (document.isOpen()) document.close(); Here we have a PDF document that is correct. But if we insert before document.open() a footer, like this: public void onEndPage(PdfWriter writer, Document document) { try { HeaderFooter footer = new HeaderFooter(new Phrase("Pag."), true); footer.setAlignment(com.lowagie.text.Element.ALIGN_RIGHT); footer.setBorder(Rectangle.NO_BORDER); ((Document) document).setFooter(footer); } catch(Exception e) { } } so we have: ... PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileDocument)); onEndPage(writer,document); document.open(); ... At the end we have the same PDF document but with Footer. And there is a white space between the end of the PdfPTable and the footer, like this: --------------------- | PdfPTable | --------------------- --------------------- | Footer | --------------------- But we want this: --------------------- | PdfPTable | --------------------- | Footer | --------------------- Only inserting ((Document) document).setFooter(footer); There is a blank space - line (offset) between them. Can we delete this blank space with some variable in document, PdfPTable, ... Thanks ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php