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,
Loading
Gowtham manjuPosted May 21, 2011, 6:36 AM
PDFLibNET.dll
StatefullScrollPanel.dll
PDFViewASP.dll
the various objectives are
Get a page count of the PDF document that needs to be viewed to define your page number boundaries (PdfLibNet - XPDF)
Convert the PDF document (specific page on demand) to a raster image format (PdfLibNet - XPDF)
Convert the current page to be viewed into a PNG file
Display the PNG file in an image on a web page
u can refer the below attached project for ur reference