This post is inspired (and 68% taken) from here. 😀
There are times when you need to combine multiple PDF files into one single PDF file. In Windows or Mac, it’s easy (as long as you are willing to spend some amount of money to buy the software), you can use Adobe Acrobat Professional. Sadly Adobe didn’t come up with Acrobat Professional for Linux platform, but luckily we have several options to do such job in a Linux box. Here’s one.
GhostScript is an interpreter for PostScript language and PDF files, and as far as I know, GhostScript is widely available by default on various Linux distro. In this post I will show you a simple trick to use GhostScript to combine any numbers of PDF files into one single PDF file. Although combining files with GhostScript has its own drawbacks, but still, for most purposes GhostScript does the job well.
Here’s the voodoo mantra, spell them on Linux terminal:
$ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf ...
And below is the explanation of each mantra:
The GhostScript program.
tells the program to exit after finishing the job.
tells the program to keep going without having conversation with the user.
tells the program to use its internal PDF writer to process the files.
tells the program where to put those scattered PDF files into one file whom name you specified.
- file1.pdf file2.pdf …
tells the program which PDFs you want to combine.
Tada, now you have combined PDF file, ready to brought anywhere without worry leaving one part behind.