Hi Team,
My requirement is to get page number of each extracted image without using page splitter . Is this any work around solution is available for this.please provide solution for this problem.
Thanks & regards,
priyanga.G
Hi Team,
My requirement is to get page number of each extracted image without using page splitter . Is this any work around solution is available for this.please provide solution for this problem.
Thanks & regards,
priyanga.G
Thanks for your inquiry. You can use LayoutCollecter class to get page number of a particular document Node, when the document is formatted into pages.
Please use LayoutCollector.getStartPageIndex method to get 1-based index of the page where node begins. This method returns 0 if node cannot be mapped to a page. For example, in following sample code snippet we are getting the page number of Paragraph Nodes. You can amend this code for your required Node.
Document doc = new Document("input.docx");
LayoutCollector layout = new LayoutCollector(doc);
for (Paragraph paragraph : (Iterable<Paragraph>) doc.getChildNodes(NodeType.PARAGRAPH, true)) {
System.out.println(layout.getStartPageIndex(paragraph));
}
Hi @tilal.ahmad ,
How to get current page number of the Extracted images.Let me know how to get current page number.
Thanks & Regards,
priyanga G
As above stated LayoutCollecter class is used to get page number of a node. You can check other methods of this class for any other details e.g. getEndPageIndex(Node node) returns page number where node ends and getNumPagesSpanned(Node node) method returns number of pages the specified node spans. Please use these methods for the purpose.
P.S: For clarity, please do not post a new question in existing thread. Always open a separate thread for a new question.