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

Free Support Forum - aspose.com

Different results from Document.getPageCount() under Windows10 and Linux

I am using the Aspose word library to count how many pages are there in a docx document. However, the page count was different while I used the getPageCount() function under Windows 10 and Linux Ubuntu

Document doc = new Document(sDocxFileName);
pageCount = this.doc.getPageCount();

The docx file was created by adobe Acrobat DC from a pdf file.

The function returns the correct page count 11 but it’s returns 21 under Linux.
I think there might be an encoding issue under two different OS.


Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS) or calling Document.getPageCount method. This method invokes page layout which builds the document in memory. You need to install fonts that are used in your document on the machine where you’re converting documents to PDF. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts
How to Install True Type Fonts on Linux

In case you are using old version of Aspose.Words, we suggest you please use latest version of Aspose.Words for Java 17.6.

Best Regards,
Tahir Manzoor