Hi,
I am trying to merge two pdf files and I want to preserve the bookmarks for them. I tried the following code but it does not display the level 2(child) bookmarks and when I click on the bookmark it does not navigate me to the original page. I also wanted to know will the aspose preserve any bookmarks for pdf attachments.
OutlineCollection bms = pdfDocument.getOutlines();
for (Iterator<OutlineItemCollection> it = bms.iterator(); it.hasNext();) {
OutlineItemCollection outlineItem = it.next() ;
OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.getOutlines());
pdfOutline.setTitle(outlineItem.getTitle());
pdfOutline.setItalic(false);
pdfOutline.setBold(false);
GoToAction goToAction = (GoToAction) outlineItem.getAction();
// Set the destination page number I have also used passing the goToAction in the below //line but it does not create the bookmark links.
pdfOutline.setAction((GoToAction) outlineItem.getDestination());
pdfDocument.getOutlines().add(pdfOutline);
}
Any help will be appreciated.
Thanks
I am trying to merge two pdf files and I want to preserve the bookmarks for them. I tried the following code but it does not display the level 2(child) bookmarks and when I click on the bookmark it does not navigate me to the original page. I also wanted to know will the aspose preserve any bookmarks for pdf attachments.
OutlineCollection bms = pdfDocument.getOutlines();
for (Iterator<OutlineItemCollection> it = bms.iterator(); it.hasNext();) {
OutlineItemCollection outlineItem = it.next() ;
OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.getOutlines());
pdfOutline.setTitle(outlineItem.getTitle());
pdfOutline.setItalic(false);
pdfOutline.setBold(false);
GoToAction goToAction = (GoToAction) outlineItem.getAction();
// Set the destination page number I have also used passing the goToAction in the below //line but it does not create the bookmark links.
pdfOutline.setAction((GoToAction) outlineItem.getDestination());
pdfDocument.getOutlines().add(pdfOutline);
}
Any help will be appreciated.
Thanks