how to repeat report header and footer in everypage by itextsharp using PageEvent? I found the report header is not repeat if we add
pdfWriter.PageEvent = new MarginalHelper(); public class MarginalHelper: PdfPageEventHelper { public override void OnStartPage(PdfWriter pdfWriter, Document document) { new HeaderInformation(pdfWriter); } public override void OnEndPage(PdfWriter pdfWriter, Document doc) { ReportFooter(pdfWriter.DirectContent); }}
Header wont appear in the first page. Anyone know a solution for this? i do not want to use a table for headers .
As documented, you should never add content in the OnStartPage() method, only in the OnEndPage() method. In other words: move new HeaderInformation(pdfWriter); to the OnEndPage() method. Also make sure that you declare the PageEvent before opening the document.
No comments:
Post a Comment