Set License & then Get Correct Count of Pages in Word Document (C# .NET)

Aspose.Words is returning wrong page count for some word documents.
Page count is supposed to be 6, but Aspose.Words is returning it as 3.

We tried with latest version, with out any success.

Can you please help us. BTW we are licensed users for couple of years.


Please ZIP and upload your source Word document you are getting this problem with here for testing. We will then investigate the issue on our end and provide you more information.

Can you please navigate where to upload, I couldn’t find an option to upload/attach in the site

We are using .NET and following is the function where stream is passed
ASPOSE.jpg (61.8 KB) Lighting Service.docx (67.5 KB)


After an initial test with the licensed latest (21.6) version of Aspose.Words for .NET, we were unable to reproduce this issue on our end. Can you please also create a standalone simplified Console Application (source code without compilation errors) that helps us to reproduce this problem on our end, compress it into ZIP format and attach the .zip file here for testing? Please do not include Aspose.Words DLL files in it to reduce the file size. We will then start further investigation into your issue and provide you more information.

I tried creating console application and page count returned is correct.

Ours is an API application (web application), but our API application is returning wrong page count. 4.6.1 is the .net framework. As far as I reviews project settings are same for both the projects.

Is there something specific for web applications that I have do…

both the applications are pointing to same word document.

Found the cause, we are using both Aspose.PDF and Aspose.Words within same function call

license (SetLicense()) was ONLY set for Aspose.PDF and we are calling functions within “Aspose.Words” without setting license for Aspose.Words

We updated code to set license for both Aspose.PDF and Aspose.Words within same function.
By setting both license files we are now getting correct page count of word documents.


Yes, you need to set the license separately for each Aspose API that you are using. It is great that you were able to resolve the problem on your end. In case you have further inquiries or may need any help in future, please let us know by posting a new thread in Aspose.Words’ forum.