Example usage for com.lowagie.text.pdf PdfName FIRST

List of usage examples for com.lowagie.text.pdf PdfName FIRST

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfName FIRST.

Prototype

PdfName FIRST

To view the source code for com.lowagie.text.pdf PdfName FIRST.

Click Source Link

Document

A name

Usage

From source file:de.offis.health.icardea.cied.pdf.extractor.PDFiText2Extractor.java

License:LGPL

/**
 * This method will populate the text bookmark list.
 * //from   w  w w. ja v  a  2 s  .  co m
 * @param rootOutlinesPdfDictionary The node element for the bookmark item.
 * @param indentionString The base indention string to be used.
 */
@SuppressWarnings("unchecked")
private void populateBookmarkTextList(PdfDictionary rootOutlinesPdfDictionary, String indentionString) {
    PdfDictionary outlineItemPdfDictionary = (PdfDictionary) PdfReader
            .getPdfObjectRelease(rootOutlinesPdfDictionary.get(PdfName.FIRST));
    while (outlineItemPdfDictionary != null) {
        PdfString bookmarkTitle = (PdfString) PdfReader
                .getPdfObjectRelease(outlineItemPdfDictionary.get(PdfName.TITLE));
        bookmarkTextList.add(indentionString + bookmarkTitle.toUnicodeString());
        logger.trace(indentionString + bookmarkTitle.toUnicodeString());

        /*
         * Recursive call to fill List
         */
        populateBookmarkTextList(outlineItemPdfDictionary, indentionString + bookmarkIndentionString());

        /*
         * Get next outline item
         */
        outlineItemPdfDictionary = (PdfDictionary) PdfReader
                .getPdfObjectRelease(outlineItemPdfDictionary.get(PdfName.NEXT));
    } // end while
}

From source file:it.flavianopetrocchi.jpdfbookmarks.itextbookmarksconverter.iTextBookmarksConverter.java

License:Open Source License

private Bookmark getBookmark() {
    PdfDictionary catalog = reader.getCatalog();
    PdfObject obj = PdfReader.getPdfObjectRelease(catalog.get(PdfName.OUTLINES));
    if (obj == null || !obj.isDictionary()) {
        return null;
    }/*from w  w  w . j  a  v  a2s  .  c o m*/
    PdfDictionary outlines = (PdfDictionary) obj;
    //        pages = new IntHashtable();
    //        int numPages = reader.getNumberOfPages();
    //        for (int k = 1; k <= numPages; ++k) {
    //            pages.put(reader.getPageOrigRef(k).getNumber(), k);
    //            reader.releasePage(k);
    //        }
    initPages();

    Bookmark root = new Bookmark();
    root.setTitle("Root Bookmark");
    bookmarkDepth(root, (PdfDictionary) PdfReader.getPdfObjectRelease(outlines.get(PdfName.FIRST)));
    //        bookmarkDepthIterative(root, outlines);
    return root;
}

From source file:it.flavianopetrocchi.jpdfbookmarks.itextbookmarksconverter.iTextBookmarksConverter.java

License:Open Source License

private void bookmarkDepth(Bookmark father, PdfDictionary outline) {
    Bookmark bookmark = null;/*  w  w w .  j a v a  2  s . c o m*/
    while (outline != null) {
        bookmark = bookmarkFromDictionary(outline);
        PdfDictionary first = (PdfDictionary) PdfReader.getPdfObjectRelease(outline.get(PdfName.FIRST));
        if (first != null) {
            bookmarkDepth(bookmark, first);
        }
        father.add(bookmark);
        outline = (PdfDictionary) PdfReader.getPdfObjectRelease(outline.get(PdfName.NEXT));
    }

}