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

Free Support Forum - aspose.com

Document.PageCount returns icorrect value at different operating systems using Java


Working with Aspose Word Java

I have a document that depending on the environment does not returns the same number of pages.
It is not related to the presence or absence of the license (also the doc document return the right number of pages when the license is provided).

Do you know what could be wrong? Fonts?

Sources with files in it.

sae.asposetest-1.0-SNAPSHOT-sources.zip (93.3 KB)

On my local environment :
License up
test.doc : 2 pages
test.docx : 3 pages
test.odt : 3 pages

No license
test.doc : 3 pages
test.docx : 3 pages
test.odt : 3 pages

On our integration :
No license
test.doc : 2 pages
test.docx : 2 pages
test.odt : 2 pages


Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS) or getting page count. You need to install fonts that are used in your document on the machine where you are getting page count. Please refer to the following article:
How Aspose.Words Uses True Type Fonts

Thanks for the reply,

Is there any way to troubleshoot missing fonts?
We are receiving documents from our clients, so we cannot be sure font are embedded or that fonts are existing in our system.
Is there a way to provide a replacement font?


We suggest you please read the following article.
How to Receive Notification of Missing Fonts and Font Substitution during Rendering

You can use FontSettings.SubstitutionSettings property for settings related to font substitution mechanism. Please read the following article.
How to Specify the Default Font to use when Rendering

Sorry for the late reply.
So there were missing fonts.
Once added, issue is fixed.


Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.