Click here to Skip to main content
13,252,362 members (61,507 online)
Rate this:
Please Sign up or sign in to vote.
I am creating the pdf of the large tables dynamically. so i need to add a footer line and a page numbers to the document. i have applied code for it and it worked. but later i made some changes so it disappears and not coming back after reverting all the code too. so please tell me where i am doing the mistake.....
code for reference......
i declared the document in global with page size as,
Document document = new Document(PageSize.A4, -60, -60, 30, 30);

i have added the class as following for itextsharp v 5.3.3

public class FooterPDF : iTextSharp.text.pdf.PdfPageEventHelper
    int i = 0;
    public override void OnEndPage(PdfWriter writer, Document document)
        i += 1;
        //base.OnEndPage(writer, document);
        PdfPTable footerTable = new PdfPTable(1);
        footerTbl.TotalWidth = 216f;
        footerTable.TotalWidth = document.PageSize.Width;
        footerTable.LockedWidth = true;
        footerTable.HorizontalAlignment = Element.ALIGN_CENTER;
        Paragraph para = new Paragraph("© VIP FINANCIAL EDUCATION");
        PdfPCell cell = new PdfPCell(para); cell.Border = 1; cell.PaddingLeft = 10;
        para = new Paragraph(i.ToString());
        cell = new PdfPCell(para);
        cell.HorizontalAlignment = Element.ALIGN_RIGHT;
        cell.Border = 0;
        cell.PaddingRight = 10;
        footerTable.WriteSelectedRows(20, -1, 10, footerTable.TotalHeight, writer.DirectContent);                   
and nothing is working.
Posted 29-Oct-12 21:22pm
Updated 29-Oct-12 21:34pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 30 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100