Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I heard that bookmarks of a pdf file are stored in plain text somewhere in the file. I was wondering if it is possible to import and export bookmarks of a pdf file into and from a text file, for batch processing?

If yes, is there any description on the syntax for editing the text file containing bookmarks of a pdf file?

I was hoping for free software solutions for Ubuntu 10.10 and for Windows 7.

Thanks and regards!

share|improve this question

3 Answers 3

up vote 9 down vote accepted

There's quite a variety of tools that can extract bookmarks from a pdf to a plain text file, and vice versa. For example, you can use pdftk, the iText toolbox (older versions only, get itext-2.0.1.jar), my own pdfWritebookmarks tool, and JPdfBookmarks which even has a GUI.

I have a script that can convert between the formats of many of these tools:

Another very nice way is to add bookmarks to a pdf via pdflatex.

share|improve this answer

The specification for PDF files is available as a freely downloadable PDF from Adobe - or at least it was last time I checked. However, most PDF files have most compressible data in them compressed. There probably was a basically plaintext version of PDF once upon a time, and if so it will still be valid now, but actually getting a file in that form may be a problem.

Although I haven't done it, one very likely possibility (if you're willing to pay) is to buy Acrobat Pro, and to use the Javascript scripting abilities built into that application. To get you started...

This tutorial shows how to create bookmarks automatically using Javascript in Acrobat 7.0 Pro (the version included in Creative Suite CS2). Although that's getting a bit old, the same technique should work fine for newer versions.

Adobe applications do include a library for reading/writing text files using Javascript (something that Javascript doesn't have as standard), so it's possible to write your own import/export scripts, though non-trivial to make those scripts robust.

share|improve this answer
Thanks! Is there a Linux version of Acrobat Pro ? –  Tim Apr 28 '11 at 6:58
Sorry - I very much doubt it. AFAIK its a Mac or Windows thing, and Adobe are unlikely to support Linux unless a huge number of creative professionals (1) start using that platform, and (2) show that they're willing to pay lots for proprietary software rather than use FOSS alternatives. Seems unlikely. For a free solution, you might try a library such as… (for Ruby). I know even less about this - I just found it on Google. –  Steve314 Apr 28 '11 at 7:10

If you have a version of a document that has bookmarks and want to copy them over, a much simpler way is to use PDF-XChange Viewer (I used v2.5.211). Open the PDF that has the bookmarks (the source PDF), select all the bookmarks in the bookmarks pane, copy them using Ctrl+C, open the PDF that doesn't have the bookmarks (the target PDF), and paste them (Ctrl+V) in that PDF's bookmarks pane. PDF-Xchange Viewer preserves bookmark properties as they were from the source PDF (including any bold / italic formatting on the bookmark text). If for some reason some of the sections of the target PDF are lower or higher due to revisions made to the document, you can click the bookmark needing correction, scroll to where on the page you'd like the bookmark to open to, right-click the bookmark again and click "Set Destination". Repeat this last part as needed for any offending bookmark. Save the target PDF when finished.

This worked great for me, was quite intuitive, and I was done in a few minutes. In my particular scenario, a co-worker had produced a very long document using Word for Mac which didn't have bookmarks. Due to the length of the document, I wanted bookmarks corresponding to the document's outline. I could get Word for Windows to save the document as a PDF with bookmarks, but some formatting differences between Word for Windows and Word for Mac threw off the page count quite off (in particular, there were differences in white space around footers, and differences in the spacing between figures and the caption). I was able to play around with the headers & footers and figure sizes to get the pagination correct in Word for Windows, then saved to PDF w/ bookmarks. Unfortunately, there still were some differences in the formatting such that I wished to just apply the bookmarks to the original PDF, and that's when I figured out the solution above.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.