Hi!
We are using Aspose.Words for .Net. We are using .Net Framework 4.5.2 and our production version of Aspose.Words is 17.9.0.0, however we tried the latest version at this time, 18.8.0.0 and we found the same issue. We are fully licensed.
The issue is that for certain documents, the page count is wrong. Usually it is off by one page but we did find a case where it was off by 3 pages. A bit more about our context: we are dealing with original legal documents that we cannot modify and for statistical purposes we need to obtain their page count. I mention this because I am aware of similar topics where the advice is to re-work the document which is legally impossible in our case.
Here is the portion of the code that obtains the page count, it inserts it in a structure that contains other information about the document:
private void GetStatistiquesDocument(Aspose.Words.Document doc)
{
if (null != doc)
{
//doc.UpdatePageLayout();
int nombrePages = doc.PageCount;
_donneesBrutes.Add(new DonneeBrute()
{
Champ = StatistiquesDocument.NombreDePages.ToString(),
Valeur = nombrePages.ToString(),
Source = DonneeBrute.TypeSource.Inconnu
});
}
}
As you can see, we tried to do an UpdatePageLayout previous to the PageCount but the result was the same. I am attaching a zip document with 2 documents that are off by one page, the zip also includes a text file describing the expected results and what each version of Aspose.Words returned us.
PageCountDetails.zip (86.4 KB)
Thank you in advance for helping us out with this issue!