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
Post a Comment