If you're a Linux user and need to combine multiple PDF files into one document, there are a number of options available to you.
When working with PDF files, there will be times when you need to combine
multiple files into a single PDF. When? Maybe you've created a document and want to replace the bland cover with one that
you've created in a graphics program. Or, maybe you have a set of PDF
documents on a single subject that you want to pull together into one file in order to send to a colleague.
No matter of your reasons for combine multiple PDFs are, the
question is how to do it. In Windows or the MacOS it's easy -- use Adobe
Acrobat. But there's no version of Acrobat for Linux. But that doesn't mean that all hope is lost. There are a number of
Linux utilities available that enable you to quickly and efficiently combine PDF files. This article looks at three command line utilities: Ghostscript, joinPDF, and pdfmeld. Each one does a good job of combining PDFs, and they all pack some interesting features.
Using Ghostscript
A popular tool among Linux users is Ghostscript. Ghostscript enables you to view or print Postscript and PDF files, or to convert those files to other formats. Ghostscript is also a powerful tool for combining PDFs.
To do the job, type something like the following at the command line:
Unless you're very familiar with Ghostscript, that string of commands won't mean much to you. Here's a quick breakdown:
gs -- starts the Ghostscript program
-dBATCH -- tells Ghostscript to processes the PDF files, and then exit. If you don't include this option, Ghostscript will just keep running
-dNOPAUSE -- forces Ghostscript to process each page without pausing for user interaction
-q -- stops Ghostscript from displaying messages while it works
-sDEVICE=pdfwrite -- tells Ghostscript to use its built-in PDF writer to combine the files
-sOutputFile=finished.pdf -- tells Ghostscript to save the combined PDF to a file name that you specify
The biggest advantage to Ghostscript is that it's a standard part of many Linux distributions. If you don't have it on your computer, then you
can download it. When using Ghostscript to combine PDFs, you can add any PDF-related option to the command line. For example, you can compress the PDF, target the file to an eBook reader, or you can encrypt the file. See the Ghostscript documentation for more information.
Using Ghostscript has its drawbacks, too. Unless you use Ghostscript's PDF options the merged PDF will be very bare bones. And it will be quite large, because by default Ghostscript doesn't compress PDFs. On top of that, some people may find typing long strings of options at the command line to be a bit of a chore.