Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
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.SetWidths(widths);
        footerTable.HorizontalAlignment = Element.ALIGN_CENTER;
        Paragraph para = new Paragraph("© VIP FINANCIAL EDUCATION");
        PdfPCell cell = new PdfPCell(para); cell.Border = 1; cell.PaddingLeft = 10;
        footerTable.AddCell(cell);
        para = new Paragraph(i.ToString());
        cell = new PdfPCell(para);
        cell.HorizontalAlignment = Element.ALIGN_RIGHT;
        cell.Border = 0;
        cell.PaddingRight = 10;
        footerTable.AddCell(cell);        
        footerTable.WriteSelectedRows(20, -1, 10, footerTable.TotalHeight, writer.DirectContent);                   
    }
}
and nothing is working.
Posted 29-Oct-12 21:22pm
Edited 29-Oct-12 21:34pm
(no name)10.2K
v2

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

  Print Answers RSS
0 OriginalGriff 505
1 Maciej Los 325
2 Richard MacCutchan 265
3 Mathew Soji 220
4 BillWoodruff 210
0 OriginalGriff 8,804
1 Sergey Alexandrovich Kryukov 7,457
2 DamithSL 5,689
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411028.1 | Last Updated 30 Oct 2012
Copyright © CodeProject, 1999-2014
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