Here is the code I'm using. I get a table with 2 rows, not 3, at the bottom of the page.

        public void onEndPage(PdfWriter writer, Document document)
        {
            Rectangle page = document.getPageSize();
            PdfPTable head = new PdfPTable(1);
            PdfPTable foot = new PdfPTable(1);
            PdfPCell cell;
            PdfContentByte cb = writer.getDirectContent();
           
            // compose the footer
            String text = "Page " + writer.getPageNumber() + " of ";
            float textSize = helv.getWidthPoint(text, 12);
            float textBase = document.bottom() - 20;
            cb.beginText();
            cb.setFontAndSize(helv, 12);
           
            // for odd pagenumbers, show the footer at the left
            if ((writer.getPageNumber() & 1) == 1)
            {
                cb.setTextMatrix(document.left(), textBase);
                cb.showText(text);
                cb.endText();
                cb.addTemplate(tpl, document.left() + textSize, textBase);
            }
            // for even numbers, show the footer at the right
            else
            {
                float adjust = helv.getWidthPoint("0", 12);
                cb.setTextMatrix(document.right() - textSize - adjust, textBase);
                cb.showText(text);
                cb.endText();
                cb.addTemplate(tpl, document.right() - adjust, textBase);
            }
           
            if (sensitivity != null)
            {
                cell = cellFromParagraph(sensitivity.toUpperCase(),
                        tnr12boldItalic, Paragraph.ALIGN_CENTER);
            } 
            else
            {
                cell = cellFromParagraph("UNRESTRICTED", tnr12boldItalic,
                        Paragraph.ALIGN_CENTER);                       
            }       
           
            head.addCell(cell);
           
            if (exportControl == null)
            {
                foot.addCell(cell);
                foot.addCell(cellFromParagraph(SecurityUtilities.getExportControlWarningLabel1().getText(),
                        tnr12boldItalic, Paragraph.ALIGN_CENTER));
                foot.addCell(cellFromParagraph(SecurityUtilities.getExportControlWarningLabel2().getText(),
                        tnr12boldItalic, Paragraph.ALIGN_CENTER));
            }
            else
            {
                foot.addCell(cell);
                foot.addCell(cellFromParagraph("jkjljlkjljklkjlk",
                        tnr12boldItalic, Paragraph.ALIGN_CENTER));
                foot.addCell(cellFromParagraph("jkjldddddddddddddddddddjlkjljklkjlk",
                        tnr12boldItalic, Paragraph.ALIGN_CENTER));
            }
           
            head.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
            head.writeSelectedRows(0, -1, document.leftMargin(), page.height() - document.topMargin() + head.getTotalHeight(),
                    writer.getDirectContent());  
            foot.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
            foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(),
                    writer.getDirectContent());         
        }


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to