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

Free Support Forum - aspose.com

Problem with getting page count by Aspose words

Hi there

I 've got some problem when getting page count by Aspose words 15.6.0

1.The result is different from the page count by Microsoft Word.
(doc in attachement is correct, docx in attachement is wrong)

2.Memory consumption is very high when opening the large file like files in the attachement.
Is there some kind of “optimized-memory mode”?
Or Is there any way to get page count with loading only some parts of file instead of loading whole file?

here is my code:

FileInputStream fis = new FileInputStream(filePath);
com.aspose.words.Document doc = new com.aspose.words.Document(fis);

int result =

Assert.assertEquals(expect, result);

Appreciate your help :slight_smile:

Hi there,

Thanks for your inquiry. Please
note that Aspose.Words requires TrueType fonts when rendering documents
to fixed-page formats (PDF, XPS or SWF) or getting page count. Make sure you have all the
Fonts installed on your machine you’re using to convert Word document to
PDF format. I would suggest you please read the following articles:


If you still face problem, please share the fonts used in your document here for investigation purposes.

Regarding performance issue, please note that performance and memory usage all depend on complexity
and size of the documents you are generating. While rendering a document to fixed page formats (e.g. PDF or getting page count), Aspose.Words needs to build two model in the memory – one for document and the other for rendered document.

The process of building layout model is
not linear; it may take a minute to render one page and may take a few
seconds to render 100 pages. Also, Aspose.Words has to create APS (Aspose Page Specification)
model in memory and this may again eat some more time for some
documents. Rest assured, we’re always working on improving performance;
but, rendering will be always running slower than simple saving to flow
formats (e.g doc/docx).