pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Grosso <gary.gro...@oberontech.com>
Subject how to create an entire bookmark (outline) tree in an existing PDF document?
Date Fri, 28 Aug 2015 15:54:05 GMT
Greetings knowledgeable ones,

I'm new to PDFbox, and am under some time pressure to get back to a customer  with confirmation
we can do what they want and a rough estimate.

For background, they have a single PDF file that is a master TOC linking to hundreds of subordinate
topic PDFs. They would like each such topic PDF to have bookmarks which would essentially
parallel the master TOC, such that an end user can click a bookmark in any topic PDF to navigate
to any other topic PDF.

I am creating this master TOC, using proprietary software, so I have the data "in hand" -
what the titles and hierarchy are, and what the filenames are each one should link to. This
proprietary software does not have the capability to generate the desired bookmarks in the
topic PDFs - it can only generate internal links to items within the current PDF document
-- but it does have the ability to call a Java application, so that is where I want to use
PDFbox, to post-process the topic-PDF output and add the bookmarks.

I've  been browsing through the Javadoc, and I'm pretty sure I need to be working with PDOutlineNode
and PDOutlineItem. I can see methods which sound like they could be used to add more items
and sub-nodes to the tree, but I'm not seeing how to link the tree into the document to begin
with.  There is not much in the way of example code or cookbook-type references, and what
I do find is 90% about reading PDFs and very little about modifying/augmenting them. So, I
could really use some help knowing how to get started.

I could create these topic PDFs with no bookmarks at all, or generate them with one bookmark
to the top of page 1, whichever is easier to work with. (I'm thinking it may be easier if
I have a sort of placeholder to start with.)

Thanks for any help,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message