Try something like:

Use onEndPage to add the footer - you'll need to use PdfPTable.writeSelectedRows()
This call can be made to only execute on the last page by setting a flag after you write the last element to the pdfDoc.

i.e., if the last thing you right is a signature Phrase, then

pdfDoc.add(sigPhrase);
printFooter = true;

where printFooter is a boolean variable available to both the code adding elements to the body ofthe PDF and to the onEndPage event handler

then in onEndPage use:

if (printFooter) {

        // construct table

        footerTable.writeSelectedRows(<args here>);        

}

Hope that helps

Kiers




"Kurakula, Suneetha (HCF)" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

12/08/2004 22:09

To
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc
Subject
[iText-questions] add footer table only at the bottom of last page





Hi All,
 
 
My table contains an image and some text that needs to be displayed as
Logo of company at the end,bottom or foot of page only.
Can anyone please let me know how I can set table as footer of last page.
 
I tried doing this by finding dimension. But it didn't help me.
 
           Table footertable = helper.getFooterTable(path);
           Dimension footdimension = footertable.getDimension();
 
                                    if (!writer.fitsPage(footertable)) {
                                                document.newPage();
                                    }
                           PdfContentByte cb = writer.getDirectContent();
                           cb.moveTo(document.left(), (document.bottom()- footdimension.height));
 
                           document.add(footertable);
 
I tried even adding  above code to this method  onCloseDocument(PdfWriter writer, Document document)
 
Can anyone please suggest me ?
 
Thanks,
Suneetha
 
 

Reply via email to