List of usage examples for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDPageFitDestination setPage
public void setPage(PDPage page)
From source file:uia.pdf.PDFMaker.java
License:Apache License
/** * Add bookmark.//from w ww .ja va 2s.com * @param page Page. * @param text bookmark text. * @throws IOException */ public PDPage addBookmark(ContentView view, PDPage page, String text) throws IOException { text = text == null ? "" : text.trim(); PDPageFitDestination dest = new PDPageFitDestination(); dest.setPage(page); for (PDOutlineItem oi : this.temp) { oi.setDestination(dest); } if (text.trim().length() > 0) { this.lastOI = new PDOutlineItem(); this.lastOI.setDestination(dest); this.lastOI.setTitle(text); this.hierarchyOI.peek().addLast(this.lastOI); this.bookmarkPages.add(new BookmarkPage(text, "" + this.doc.getNumberOfPages())); this.temp.add(this.lastOI); } page = view.drawBookmarks(page, this.temp); this.temp.clear(); return page; }