Merging PDF files in Linux while preserving the links

I wanted to merge multiple PDF files on Linux, without messing up the links in the individual files. There was a Linux.com article on merging PDF files using Ghostscript and using pdfmeld (a commercial software).

The Ghostscript method works, but completely messes the links up. Searching on Google also didn't return any instant pointers. But it did get me to pdftk. It's a really useful utility for meddling with PDF files.

To merge two PDF files, the command is:
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

And to make it even better, links work flawlessly in the merged PDF files. Hooray!

PS: I created the individual test files using OpenOffice Writer. They had navigational hyperlinks to sections inside the same files.

Update: It seems there's a good GUI for pdftk - PDF Chain. I haven't used it yet, but people seem to be appreciating it.

Comments

  1. Thank you, it was useful to learn about that, I was using pdfjoin, but it doesn't preserve my links!

    ReplyDelete
  2. Thanks. Happy to be of some help.
    This came up on Planet KDE a few days back:
    https://liquidat.wordpress.com/2015/04/05/short-tip-splitting-and-merging-pdf-files/
    Please do check it out. Might preserve links, but I don't know for sure.

    ReplyDelete

Post a Comment

Popular posts from this blog

പേര്

Qt - Enabling qDebug messages and Qt Creator

ബിഗ് റേഡിയോ ഇതിഹാസം