on-internet
← Community

how to insert header and footer to existing pdf document using itextsharp (without overriding the existing content of the page)

Stack Overflow ·

In my project I am using MVC4,C# and itextsharp to generate pdf from html. I need to insert header with a logo and template name, and footer with paging (page number/Total number of pages). I am done the the footer, I have used this code to add footer to the pdf file: public static byte[] AddPageNumbers(byte[] pdf) { MemoryStream ms = new MemoryStream(); ms.Write(pdf, 0, pdf.Length); // we create a reader for a certain document PdfReader reader = new PdfReader(pdf); // we retrieve the total number of pages int n = reader.NumberOfPages; // we retrieve the size of the first page Rectangle psize

Comments

Sign in or sign up to comment and upvote.

No comments yet.