如何在PDF中显示页数?

时间:2012-04-04 05:23:51

标签: asp.net pdf itextsharp

我正在使用ItextSharp在我的应用程序中创建Pdf。当用户点击提交时,动态生成pdf并显示给用户。我面临的问题是我无法显示该pdf中存在的总页数。我使用图像作为标题,并在页脚中再次使用图像,我不想根据要求在页脚中显示页码。所以我想要像

这样的东西

“总页数:2(PDF格式中的页面)”在我的pdf的第一页上。是否可以这样做请提出建议。

1 个答案:

答案 0 :(得分: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();
相关问题