I want to extract one/multiple pages from a document and save it to a pdf, docx or some other format. Is it possible?
document is flow document and does not contain any information about
its layout into lines and pages. Therefore, technically there is no “Page” concept in Word document. Pages are created by Microsoft Word on the fly.
Aspose.Words.Layout namespace provides classes that allow to access
information such as on what page and where on a page particular document
elements are positioned, when the document is formatted into pages.
Please use the attached utility to extract the pages according to your requirements. Hope this helps you.
Document doc = new Document(“C:\Temp\in.doc”);
LayoutCollector layoutCollector = new LayoutCollector(doc);
DocumentPageSplitter splitter = new DocumentPageSplitter(layoutCollector);
Document pageDoc = splitter.GetDocumentOfPage(5);
I am not able to find DocumentPageSplitter class in aspose-words-14.5.0-jdk16 jar. Can you please let me know where should I get it
It is not working as expected you can check with this doc.
Thanks for your inquiry. We are checking this scenario and will get back to you soon.
I tested with that document and it is working as expected. I will test with other documents as well and let you know if I face any other issues.