Пример #1
0
        public bool AddBookmarks(PDFBookmark bookmarks)
        {
            bool flag;

            try
            {
                PDDocumentOutline pDDocumentOutline = new PDDocumentOutline();
                this.PDFBoxDocument.getDocumentCatalog().setDocumentOutline(pDDocumentOutline);
                foreach (PDFBookmarkItem bookmarkItem in bookmarks.BookmarkItems)
                {
                    PDOutlineItem pDOutlineItem = new PDOutlineItem();
                    PDFHelper.AddBookmarkTooutline(bookmarkItem, this.PDFBoxDocument, pDOutlineItem);
                    pDDocumentOutline.addLast(pDOutlineItem);
                }
                pDDocumentOutline.openNode();
                flag = true;
            }
            catch (Exception exception)
            {
                flag = false;
            }
            return(flag);
        }
Пример #2
0
        public PDFBookmark GetBookmarks()
        {
            PDFBookmark pDFBookmark;

            try
            {
                PDDocumentOutline documentOutline = this.PDFBoxDocument.getDocumentCatalog().getDocumentOutline();
                PDFBookmark       pDFBookmark1    = new PDFBookmark();
                object[]          objArray        = IteratorUtils.toArray(documentOutline.children().iterator());
                for (int i = 0; i < (int)objArray.Length; i++)
                {
                    object obj = objArray[i];
                    PDFHelper.addBookmark((PDOutlineItem)obj, pDFBookmark1.BookmarkItems, this.PDFBoxDocument);
                }
                pDFBookmark = pDFBookmark1;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                throw new PDFToolkitException(exception.Message, exception);
            }
            return(pDFBookmark);
        }