Combining Multiple PDF Files Into One PDF File in Linux

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:

  • gs
    The GhostScript program.
  • -dBATCH
    tells the program to exit after finishing the job.
    tells the program to keep going without having conversation with the user.
  • -sDEVICE=pdfwrite
    tells the program to use its internal PDF writer to process the files.
  • -sOutputFile=finished.pdf
    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.

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: