Jack Slingerland
Jack Slingerland

Reputation: 2811

How can I read PDF Bookmarks with PHP?

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!

Upvotes: 1

Views: 1941

Answers (2)

Uli H.
Uli H.

Reputation: 11

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).

Upvotes: 1

Marc B
Marc B

Reputation: 360662

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.

Upvotes: 1

Related Questions