Page.Count returns incorrect page count of Word document using C#

Hi Team

When generating the HTML for a docx document , we are got problem getting page count incorrect value as per original file page count by Aspose words (latest).
This is happen on some file. I can share only screen shot of it.

            // Create word document instance.
            Document requestedDocument;
            Document requestedDocumentTemp;
            try
            {
                requestedDocument = new Document(filePath);
                requestedDocument.UpdatePageLayout();
                requestedDocument.UpdateWordCount();

                // Set page count return value.
                pageCount = requestedDocument.PageCount;
            }
            catch (Exception)
            {
                DatabaseLogging.Log(uniqueID, "DocxConverter", "error in updating page layout and word count");
                throw new Exception("Sorry, the document you have uploaded is corrupted, " + 
                                    "please upload another file.");
            }

Can you please suggest us on this.

@uk_itprocurement_tcs_com

Could you please attach your input Word document here for testing? We will investigate the issue on our side and provide you more information.

Hi Team
Please use this document
count issue.zip (1.1 MB)

@uk_itprocurement_tcs_com

We have tested the scenario using the latest version of Aspose.Words for .NET 20.1 and have not found the incorrect page count issue. So, please use Aspose.Words for .NET 20.1.

Hi Team
I tested the scenario using the latest version of Aspose.Words for .NET 20.1 and still found incorrect page count issue.

Thank You.

@uk_itprocurement_tcs_com

Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS) or getting page count . You need to install fonts that are used in your document on the machine where you are getting page count. Please refer to the following article:
How Aspose.Words Uses True Type Fonts

Hi Team
Aspose.Words TrueType fonts is not a issue . As we research on this and found that section break make page count increase from original page count. If we have page full of content with section break in page then its adding extra page at HTML.

Please see attachment with original docx with html.

with section break.zip (33.8 KB)
without section break.zip (33.0 KB)
Thank You

@uk_itprocurement_tcs_com

We have tested the scenario using the following code example and have not found the shared issue.

Document doc = new Document(MyDir + "SectionBreakPageCountBug-Page1SectionBreak.docx");
Console.WriteLine(doc.PageCount);
doc.Save(MyDir + "20.1.html", SaveFormat.HtmlFixed);

Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.