Thanks for commenting. You can refer to the below code to delete the bookmarks that have no child bookmarks:
PdfDocumentdoc=newPdfDocument();doc.loadFromFile("D:/BookmarkSample.pdf");for(inti=0;i<doc.getBookmarks().getCount();i++){PdfBookmarkpb=doc.getBookmarks().get(i);//Remove the bookmark that has no child bookmarkif(pb.getCount()==0){doc.getBookmarks().removeAt(i);i--;}}doc.saveToFile("D:/out.pdf");
Hi,
Thanks for commenting. You can refer to the below code to delete the bookmarks that have no child bookmarks:
Thank you so much... for your reply
I have one more doubt on this, im using Apache PDFBox libs so im not able use this code