Splitting a PDF based on "Bookmarks"

"James" <jamesml-zpSWq5r+/[email protected]> Wed, 31 Oct 2007 05:19:44 -0000
Newsgroups gmane.comp.lang.perl.modules.pdfapi2
Message-ID <[email protected]>
Hello,

Sorry if this ends up being a duplicate post. The original message I
sent to the list from my home address didn't appear to make it after
10 hours, so I'm posting this via Yahoo's web interface.

Original message follows (with a couple of minor edits):

------

Hello everyone,

I'm having some trouble understanding the bookmark handling in PDF
files (and thus PDF::API2). And by bookmarks, I mean the ones Acrobat
Reader shows in the sidebar; it is essentially a list of
topics--usually chapters of a book--that, when clicked, take you to
the appropriate place in the PDF.

I have an existing large PDF report with bookmarks that point to
various sections within the report. I would like to somehow parse the
bookmark structure in the PDF using PFD::API2 and determine which page
each bookmark points to. Once I know which page starts a section
(similar to a chapter of a book, indicated by the bookmark) then I can
split the one large PDF into smaller PDFs with one PDF representing
each bookmarked section. I will also need to extract the name (the
displayed, clickable text) of the bookmark itself so I can use it when
naming each new PDF file. Which sections are included and how long
each section will vary for each report, so I can't rely on any
"static" methods to split the PDF, so I really need to parse the
bookmark information.

Would anyone have any advice or links to places that talk about the
techniques necessary to do this, some pseudo code, or an examples that
might help get me started?

Thank you all very much for your time.

-- 
James Olsen

Funny quotes: "There are 10 types of people in the world.
Those who understand binary, and those who don't." -- Unknown
"A computer once beat me at chess, but it was no match for me at
kick boxing." -- Emo Philips