Package org.pdfbox.pdmodel.interactive.documentnavigation.outline

Examples of org.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem


                PDDocumentOutline bookmarks = document.getDocumentCatalog().getDocumentOutline();
                if( bookmarks == null )
                {
                    throw new IOException( "Error: The PDF does not contain any bookmarks" );
                }
                PDOutlineItem item = bookmarks.getFirstChild().getNextSibling();
                PDDestination dest = item.getDestination();
                PDActionGoTo action = new PDActionGoTo();
                action.setDestination(dest);        
                document.getDocumentCatalog().setOpenAction(action);
               
                document.save( args[1] );
View Full Code Here


                    new PDDocumentOutline( (COSDictionary)cloneForNewDocument( destination, srcOutline ) );
                destCatalog.setDocumentOutline( cloned );
            }
            else
            {
                PDOutlineItem first = srcOutline.getFirstChild();
                PDOutlineItem clonedFirst = new PDOutlineItem( (COSDictionary)cloneForNewDocument(
                        destination, first ));
                destOutline.appendChild( clonedFirst );
            }
        }
       
View Full Code Here

     *
     * @throws IOException If there is an error getting the page count.
     */
    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();
        }
       
    }
View Full Code Here

                    System.err.println( "Error: Cannot add bookmarks to encrypted document." );
                    System.exit( 1 );
                }
                PDDocumentOutline outline =  new PDDocumentOutline();
                document.getDocumentCatalog().setDocumentOutline( outline );
                PDOutlineItem pagesOutline = new PDOutlineItem();
                pagesOutline.setTitle( "All Pages" );
                outline.appendChild( pagesOutline );
                List pages = document.getDocumentCatalog().getAllPages();
                for( int i=0; i<pages.size(); i++ )
                {
                    PDPage page = (PDPage)pages.get( i );
                    PDPageFitWidthDestination dest = new PDPageFitWidthDestination();
                    dest.setPage( page );
                    PDOutlineItem bookmark = new PDOutlineItem();
                    bookmark.setDestination( dest );
                    bookmark.setTitle( "Page " + (i+1) );
                    pagesOutline.appendChild( bookmark );
                }
                pagesOutline.openNode();
                outline.openNode();
               
View Full Code Here

    {
        final PDDocumentOutline outline = getPDFDocument().getDocumentCatalog().getDocumentOutline();
        final List result = new ArrayList();
        if (outline != null)
        {
             PDOutlineItem child = outline.getFirstChild();
            while (child != null)
            {
              final PdfBoxPDFBookmark topBookmark = new PdfBoxPDFBookmark(child, null);
              result.add(topBookmark);
              result.addAll(topBookmark.getAllChildren());
              child = child.getNextSibling();
            }
        }
        return result;
    }
View Full Code Here

    children_ = readChildren();
  }

  protected List readChildren() {
    final List children = new ArrayList();
      PDOutlineItem nativeChild = nativeBookmark_.getFirstChild();
        while (nativeChild != null) {
          children.add(new PdfBoxPDFBookmark(nativeChild, this));
            nativeChild = nativeChild.getNextSibling();
        }

    return children;
  }
View Full Code Here

  private void getBookmarks() {
    bookMarkList = new ArrayList();
    PDDocumentOutline root = pdDocument.getDocumentCatalog()
        .getDocumentOutline();
    if (root != null) {
      PDOutlineItem item = root.getFirstChild();
      rekursionBookmarks(item);
    }
  }
View Full Code Here

    }
  }
  private void rekursionBookmarks(PDOutlineItem bla) {
    while (bla != null) {
      bookMarkList.add(bla.getTitle());
      PDOutlineItem child = bla.getFirstChild();
      rekursionBookmarks(child);
      bla = bla.getNextSibling();
    }
  }
View Full Code Here

TOP

Related Classes of org.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.