find the number of pages in PDF.

Posted by Bageshkumarbagi under C# category on | Points: 40 | Views : 1021
Hi here code to find the number of pages in PDF.

1. you need to add itextsharp.dll dll.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using iTextSharp.text.pdf;
using iTextSharp.text.xml;
namespace WindowsFormsApplication1
public partial class Form3 : Form
public Form3()

private void button1_Click(object sender, EventArgs e)
string ppath = "D:\\Effective_Methods_for_Software_Testing.pdf";
PdfReader pdfr = new PdfReader(ppath);
int no_of_Pages = pdfr.NumberOfPages;
MessageBox.Show("" + no_of_Pages);


Comments or Responses

Login to post response