tags:

views:

46

answers:

1

Hi,

I am trying to write a footer using ITextSharp library 5.0.4 and not able to print page number since OnEndPage and OnClosePage are not getting called.

This is a simple console app where I am printing tables to generate couple of pages and expecting OnEndPage or OnClosePage to get called where my code for footer will get executed once document.close() method gets executed.

Please let me know what must be wrong with this ?

A: 

You'll need to create a class that extends PdfPageEventHelper and override OnStartPage and OnEndPage there. Use this helper class to handle the PageEvent in your PdfWriter.

Massoud Mazar's blog post Code sample for using iTextSharp PDF library has a fine example.

If you're doing this and still have problems please post some code.

Jay Riggs
Thanks for this post. I had already refered that blog , only thing remaining was to assign writer.pageevents
AHK
writer.PageEvent = PageEventHandler;
AHK