Page count mismatch issue

Hi team,
I need to get the correct page count for a document; however, the current code is giving me 68 pages instead of the actual 70 pages.

Here is my code snippets

Aspose.Words.License licWord = new Aspose.Words.License();
string strLicenscePath = "D:\\abc\\Aspose.Words_New.lic";
licWord.SetLicense(strLicenscePath);

Aspose.Words.Document doc = new Aspose.Words.Document("C:\\Users\\abc\\Desktop\\PageNoCheck.docx");
// Get the page count
int pageCount = doc.PageCount;
 // Display the page count
Console.WriteLine("Page Count: " + pageCount);
doc.Save("C:\\Users\\abc\\Desktop\\OutputDoc.docx");

Here is my documents.


OutputDoc.docx (188.6 KB)

PageNoCheck.docx (188.6 KB)

@RajChauhan i cannot reproduce the problem on my side using the latest 24.1 version. doc.PageCount returns 70 pages.
Most likely the problem on your side might occur because the fonts used in your input document are not available on the machine where document is processed. The fonts are required to build document layout and calculate page count. If Aspose.Words cannot find the font used in the document, the font is substituted. This might lead into fonts mismatch and document layout differences due to the different fonts metrics and as a result incorrect page count. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/