Return to Snippet

Revision: 35520
at November 10, 2010 00:24 by poxet


Initial Code
public static int GetNumberOfPages(string pdfData)
{
    var regx = new Regex(@"/Type\s*/Page[^s]");
    var matches = regx.Matches(pdfData);
    return matches.Count;
}

Initial URL


Initial Description
Open a PDF document and store the data in a string. Provide that string to this function and it will return the number of pages in the PDF.

Initial Title
Get number of pages in a PDF file

Initial Tags


Initial Language
C#