How to get all bookmarks in PDF file using PDFBox in Java -


i newbie in apache pdfbox. want extract bookmarks in pdf file using pdfbox library in java. idea how extract them?

from printbookmarks example in source code download

pddocument document = pddocument.load(new file("...")); pddocumentoutline outline =  document.getdocumentcatalog().getdocumentoutline(); printbookmark(outline, ""); document.close(); 

(...)

public void printbookmark(pdoutlinenode bookmark, string indentation) throws ioexception {     pdoutlineitem current = bookmark.getfirstchild();     while (current != null)     {         system.out.println(indentation + current.gettitle());         printbookmark(current, indentation + "    ");         current = current.getnextsibling();     } } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -