To read the page count of a zipped PDF file
public int GetNoOfPagesPDF(string FileName)
{
FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
StreamReader r = new StreamReader(fs);
string pdfText = r.ReadToEnd();
System.Text.RegularExpressions.Regex regx = new Regex(@"/Type\s*/Page[^s]");
System.Text.RegularExpressions.MatchCollection matches = regx.Matches(pdfText);
result = matches.Count;
return result;
//13086143_1910486.zip
}
Hi with the help of above function we can read the page count of a pdf, because of the regular expression "/Type\s*/Page[^s]" it reads the pdf page count, for a .docx file and text file it won't reads
Please tell me that is it possible to read the page count of a .docx file by changing the regular expression, if possible what is the regex
Also to read the zip file , what is the regex to be used
My requirement is to read the pdf file page count which is zipped with out unzipping it,