We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PdfFileInfo constructor takes around 300 ms to create an object


I am using PdfFileInfo class to calculate the number of pages of a pdf file.

When i call the constructor as shown below, it takes around 300 ms to create that object.

PdfFileInfo pdfFileInfo = new PdfFileInfo(bais);

Can this code be made faster to work? Are there any static methods that can be used to get the number of pages? Is there any other faster API available?



Hi Pradyumna,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, if you only need to get the page count, you may try to use Document Class (Document.Pages.Count property) as it is relatively faster than the PdfFileInfo. Please see the following sample in this regard:

Document doc = new Document(@"D:\AP Data\Jan2012\Test.pdf");

int pagecount = doc.Pages.Count;

Please feel free to contact support in case you need any further assistance.

Thank You & Best Regards,

I have a constraint that i cannot store the files on a physical location. Hence have to use a byte array. Please suggest if Document class supports the same.

There is also one more issue with using Docment. It gives the following error:

Cannot find symbol for Pages