It seems you are experiencing an issue with the PageCount property returning 4 instead of the expected 5 pages for your DOCX documents when using Aspose.Words. This discrepancy can occur due to various factors, including differences in how Aspose.Words interprets the document layout compared to Microsoft Word.
Here are some steps you can take to troubleshoot and potentially resolve the issue:
Check Document Structure: Ensure that the document does not contain any hidden content or sections that might affect the page count. Elements like page breaks or section breaks can lead to discrepancies.
Update Aspose.Words: Verify that you are using the latest version of Aspose.Words. Updates may include bug fixes or improvements that could resolve this issue.
Load Options: When loading the document, you can specify LoadOptions to control how the document is processed. For example:
var loadOptions = new Aspose.Words.LoadOptions();
var document = new Document("TestInput_PagesCount.docx", loadOptions);
Re-save the Document: Open the document in Microsoft Word and re-save it. This can sometimes correct underlying issues that affect how Aspose.Words reads the document.
Check for Compatibility: Ensure that the document is compatible with the version of Aspose.Words you are using. If the document was created with a newer version of Microsoft Word, there may be features that are not fully supported.
If the issue persists after trying these steps, consider reaching out to Aspose support with the specific documents you are testing, as they may provide more targeted assistance.
@abilger There is no bug here. Your document uses Aptos, which is cloud font, so it is not installed by default and is downloaded by MS Word on demand. Aspose.Words does not download cloud fonts.
The fonts are required to build document layout. 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. 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/
@abilger To get accurate document layout it is required to have the fonts used in your documents. Any font substitution might lead to document layout differences as described above.