How To: Concatenate PDF files in Linux
When I am working in Inkscape I often want to put together multiple-page graphics. Sadly Inkscape doesn’t yet support multiple page documents, although they are planning this feature and so it shouldn’t be too long before it does. So the way I work around this is to create multiple documents, one for each page, then use “Print to file” to save each one as a PDF. Now I have, say, 3 PDFs. All I need do now is concatenate them to create one single PDF that I can send to the customer.
Here’s one way to do it using GhostScript from the command line:
gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=logo-concepts.pdf logo-concepts-1.pdf logo-concepts-2.pdf logo-concepts-3.pdf
In this example
logo-concepts.pdf is the finished PDF with all pages appended, and logo-concepts-1.pdf, logo-concepts-2.pdf and logo-concepts-3.pdf are the individual pages. You can tweak “
-sPAPERSIZE=” to suit your needs.
As “anon” points out in the comments it is also possible to use the command “pdfjoin”, if you have it installed. The program is part of the “pdfjam” package which, at a hefty 389mb of dependencies, may not be ideal for you. Installing the package is easy though:
sudo apt-get install pdfjam
After the package and its dependencies have been installed you can simply use
pdfjoin logo-concepts-1.pdf logo-concepts-2.pdf logo-concepts-3.pdf
pdfjoin will choose a filename for the joined file for you. In this example it would create a file named logo-concepts-3-joined.pdf.