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

Free Support Forum - aspose.com

Page Count for very large documents


Our application deals with word files.
We allow uploading of documents of upto 40mb in size
However certain features are restricted for documents under 300 pages only.

When a user uploads a document, at the server side I create a Document object using aspose and get page count as follows:
Document attachmentDoc = new Document(filePath);
int pageCount = attachmentDoc.getPageCount();
//return pageCount;

If the page count exceeds 300 pages, an alert is issued to the customer to notify him that certain features will be disabled.

Now, heres my issue:

Scenario1: When a very large file of around 1000 pages of plain text (size around 4mb) is uploaded, creating the document and getting the page count takes a very long time (close to 5 mins),which is unacceptable from a usability standpoint.

Scenario2: When a file with around 20 pages full of HD images (size around 30mb) is uploaded, the above code works very fast as expected.

Is there any way I can speed up this process for scenario1?

Hi Siddarth,

Thanks for your inquiry. Could you please attach your input Word document you’re getting this problem with here for testing? I will investigate the issue on my side and provide you more information. Please also tell us the details of the development environment (e.g. JDK version, OS version) of the machine you’re getting this problem on.

Best regards,