I want to read the page count of a word document. which class and which method should I use? thanks.
This message was posted using Aspose.Live 2 Forum
I tried to use this to get page count, but it returns the wrong number.
BuiltInDocumentProperties vars = doc.getBuiltInDocumentProperties();
System.out.println("page: " + vars.getPages());
But this is not always wrong to different documents.
thanks.
Hi
Thanks for your request. BuiltInDocumentProperties.Pages property contains value written by MS Word. Aspose.Words does not update it, so if you modify you document through the code, this property can contain not actual value.
In .NET version of Aspose.Words there is Document.PageCount property, which allow to get actual number of pages in the document:
https://reference.aspose.com/words/net/aspose.words/document/pagecount/
Since MS Word document is flow document and does not contain any information about its layout into lines and pages, in Aspose.Words we use our own Rendering Engine to layouts Word document into pages. At the moment we are working on porting this feature to Java version of Aspose.Words. This feature will be available in 1-2 months. I will notify you.
Best regards.
We are happy to inform you that the first auto-ported version of Aspose.Words for Java is ready. This version supports converting documents to PDF. You can get it from here.
Best regards,
Aspose.Words team
(25)