How to display page count in PDF?

Go To StackoverFlow.com

0

I am using ItextSharp for creating Pdf in my application. When the user clicks on submit the pdf is generated on the fly and displayed to the user. The problem am facing is i am not able to display the total number of pages present in that pdf. I am using an image as a header and in footer am again using an image, i don't want to display the page number in the footer as per the requirements. So i want something like

"Total number of pages: 2(pages present in that pdf)" on the first page of my pdf. Is it possible to do this Please suggest something.

2012-04-04 05:23
by user1046930
hey try this http://www.mazsoft.com/blog/post/2008/04/30/Code-sample-for-using-iTextSharp-PDF-library.aspx and this How to get total page count of pdf pages on footerPresleyDias 2012-04-04 05:47


0

//Create instance for the PDF reader
                PdfReader pdf_fie = new PdfReader(filepath);
                //read it's pagecount
                page_count = pdf_fie.NumberOfPages;
                //close the file
                pdf_fie.Close();
2012-04-04 05:40
by Neha
Ads