Page breaks are not matching with WordObjectModel Page breaks


We are using RenderedDocument class to read the content of the document. But we have issue in identifying the page breaks of the document. we are expecting the page breaks at the place where the each page will end in the word object model but it is not happening, So can any one help to fix this issue to get the page breaks same as word object model.

we have tried with Aspose.Words v22.2.

I have given the sample file in attached sample zip file to reproduce the issue.

Below is the sample code.

RenderedDocument layoutDoc = new RenderedDocument(AsposeDocument);

foreach (RenderedPage page in layoutDoc.Pages)

} (18.7 KB)

@Gayatri_K Could you please let us know your ultimate goal of using RenderedDocument? If you need to extract content from your document page by page, there is a built-in Document.ExtractPages method, which works fine with the document you have attached:

Document doc = new Document(@"C:\Temp\in.doc");

for (int i = 0; i < doc.PageCount; i++)
    doc.ExtractPages(i, 1).Save(string.Format(@"C:\Temp\out_{0}.doc", i));

Also, you should note the document layout depend on the fonts installed in your environment. If the fonts used in your document are not available, Aspose.Words substitutes the fonts and this might lead to layout differences and as a result to incorrect page break detection.