/** * Use this method to get the root outline * and construct bookmarks. * @return the root outline */ public PdfOutline getRootOutline() { return directContent.getRootOutline(); }
/** * Use this method to get the root outline * and construct bookmarks. * @return the root outline */ public PdfOutline getRootOutline() { return directContent.getRootOutline(); }
/** * Use this method to get the root outline * and construct bookmarks. * @return the root outline */ public PdfOutline getRootOutline() { return directContent.getRootOutline(); }
protected void initBookmarks() { bookmarkStack = new BookmarkStack(); int rootLevel = isModeBatch && isCreatingBatchModeBookmarks ? -1 : 0; Bookmark bookmark = new Bookmark(pdfContentByte.getRootOutline(), rootLevel); bookmarkStack.push(bookmark); }
OutputStream outputStream = new FileOutputStream(new File(filename)); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfOutline pol = cb.getRootOutline(); PdfOutline oline1 = null; InputStream in1 = new FileInputStream(new File(inf1)); PdfReader reader = new PdfReader(in1); for (int i = 1; i <= reader.getNumberOfPages(); i++) { document.newPage(); document.setMargins(0.0F, 18.0F, 18.0F, 18.0F); PdfImportedPage page = writer.getImportedPage(reader, i); document.add(new Chunk(new Integer(i).toString()).setLocalDestination(new Integer(i).toString())); System.out.println(i); cb.addTemplate(page, 0.0F, 0.0F); } outputStream.flush(); document.close(); outputStream.close();
protected void drawBookmark( final RenderNode box, final String bookmark ) { if ( box.isNodeVisible( getDrawArea() ) == false ) { return; } final PdfOutline root = writer.getDirectContent().getRootOutline(); final AffineTransform affineTransform = getGraphics().getTransform(); final float translateX = (float) affineTransform.getTranslateX(); final float upperY = translateX + (float) ( globalHeight - StrictGeomUtility.toExternalValue( box.getY() ) ); final float leftX = (float) ( StrictGeomUtility.toExternalValue( box.getX() ) ); final PdfDestination dest = new PdfDestination( PdfDestination.FIT, leftX, upperY, 0 ); new PdfOutline( root, dest, bookmark ); // destination will always point to the 'current' page // todo: Make this a hierarchy .. }
PdfOutline outline = new PdfOutline(cb.getRootOutline(), destination, bookmark);