3

I have two pdf files, one with bookmarks, and the other without. I would like the second pdf file to have the same bookmarks as the first. I wonder how to do that using gs? Ideally, it will be nice to first extract the bookmarks from the first pdf file into a text file (which is editable if I can learn its format), and then add the text file as bookmarks to the second pdf file. Thanks!

p.s.:

I know how to add bookmarks in pdfmarks format to a pdf file by gs, from http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/

gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in-*.pdf pdfmarks

But I don't know how to extract bookmarks from a pdf directly into pdfmarks format.

p.s.: In case you may wonder what bookmarks are, they are table of contents which can be shown in a side panel of a pdf reader (such as Evince (note: in Evince bookmarks are called index)), and when you click one bookmark, it will take you to the page.

  • AFAIK PS format don't support bookmarks, so you could print the wohle pdf document to ps. – user55518 Apr 4 '14 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.