tags:

views:

45

answers:

2

I've been looking (unsuccessfully) for a way to open a PDF file and get the bookmarks out of it. I've looked at most PHP libraries for PDFs, but they seem focused on creation, not reading.

At this point, I'd be happy with a solution in any language, so it doesn't have to be PHP, but it would be nice.

Thanks!

+1  A: 

If all else fails, you could try parsing the PDF to extract the bookmark information, though exactly where it is and what it'd look like, I haven't the foggiest. At its core a PDF is just a Postscript file, and once you filter out all the binary garbage (font definitions, images, etc..) you've got a pile of plain-text Potscript code.

Marc B
That's what I've resigned myself to doing. I've found the part of the file that contains the bookmarks, so I'm just going to try and parse them out. Thanks!
Jack Slingerland
A: 

You might want to take a look at the "pCOS" library by PDFLib:

http://www.pdflib.com/products/pcos/

It is able to extract all sorts of information from existing PDF files, including bookmarks, and it's available as PHP extension. It is not free software, prices for a single server are 245 USD (195 EUR) or more, depending on the OS. (I'm in no way affiliated with the vendor).

Uli H.