Examples of PDOutlineItem


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

            extractBookmarkText(outline);
        }
    }

    void extractBookmarkText(PDOutlineNode bookmark) throws SAXException {
        PDOutlineItem current = bookmark.getFirstChild();
        if (current != null) {
            handler.startElement("ul");
            while (current != null) {
                handler.startElement("li");
                handler.characters(current.getTitle());
                handler.endElement("li");
                // Recurse:
                extractBookmarkText(current);
                current = current.getNextSibling();
            }
            handler.endElement("ul");
        }
    }
View Full Code Here

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

                    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

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

                    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 );
                int pageNum = 0;
                for( PDPage page : document.getPages() )
                {
                    pageNum++;
                    PDPageFitWidthDestination dest = new PDPageFitWidthDestination();
                    dest.setPage( page );
                    PDOutlineItem bookmark = new PDOutlineItem();
                    bookmark.setDestination( dest );
                    bookmark.setTitle( "Page " + pageNum );
                    pagesOutline.appendChild( bookmark );
                }
                pagesOutline.openNode();
                outline.openNode();
View Full Code Here

Examples of org.apache.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

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

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

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

     *
     * @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

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

     * @return true if all items are valid in this level.
     * @throws ValidationException
     */
    protected boolean exploreOutlineLevel(PreflightContext ctx, PDOutlineItem inputItem) throws ValidationException
    {
        PDOutlineItem currentItem = inputItem;
        while (currentItem != null)
        {
            if (!validateItem(ctx, currentItem))
            {
                return false;
            }
            currentItem = currentItem.getNextSibling();
        }
        return true;
    }
View Full Code Here

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

        {
            ContextHelper.validateElement(ctx, dictionary, ACTIONS_PROCESS);
        } // else no specific validation

        // check children
        PDOutlineItem fChild = inputItem.getFirstChild();
        if (fChild != null)
        {
            if (!isCountEntryPresent(inputItem.getCOSDictionary()))
            {
                addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_OUTLINES_INVALID,
View Full Code Here

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

     * @return true if all items are valid in this level.
     * @throws ValidationException
     */
    protected boolean exploreOutlineLevel(PreflightContext ctx, PDOutlineItem inputItem) throws ValidationException
    {
        PDOutlineItem currentItem = inputItem;
        while (currentItem != null)
        {
            if (!validateItem(ctx, currentItem))
            {
                return false;
            }
            currentItem = currentItem.getNextSibling();
        }
        return true;
    }
View Full Code Here

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

        {
            ContextHelper.validateElement(ctx, dictionary, ACTIONS_PROCESS);
        } // else no specific validation

        // check children
        PDOutlineItem fChild = inputItem.getFirstChild();
        if (fChild != null)
        {
            if (!isCountEntryPresent(inputItem.getCOSDictionary()))
            {
                addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_OUTLINES_INVALID,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.