Combine multiple PDFs into one file in Linux

Previously I posted how to merge multiple PDFs into one file in Windows. This is the Linux counterpart tutorial on how to combine multiple PDFs into one file. This process is really easy and quick and is extremely useful.
The first step is to install Ghostscript. You can do this by typing the following command into a terminal:
sudo apt-get install gs
The second step is to install PDFTK. You can do this by typing the following command into a terminal:
sudo apt-get install pdftk
The last step is to actually combine your PDF files into one file. You can do this by copying and pasting the following command into a terminal:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH first.pdf second.pdf third.pdf
In the above command after “-sOUTPUTFILE=” type whatever name you want for the merged file (don’t forget to append .pdf to the end of the file name). Rename “first.pdf second.pdf third.pdf” to whatever your file names are (separate your file names with a space).
After you run the above command, a new PDF will be created with your individual files merged according to the order you list (i.e., first.pdf followed by second.pdf followed by third.pdf).
Read more: Software, Productivity, Linux
Trackbacks & Pings
Comments
-
My scanner software required an upgrade ($$) in order to be able to put multiple pages into one pdf file. Saved me some cash.
Thanks -
I think you have a rather long command there. According to the pdftk man page:
”
Join in1.pdf and in2.pdf into a new PDF, out1.pdf
pdftk in1.pdf in2.pdf cat output out1.pdf
or (using handles):
pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf
or (using wildcards):
pdftk *.pdf cat output combined.pdfRemove ’page 13’ from in1.pdf to create out1.pdf
pdftk in.pdf cat 1-12 14-end output out1.pdf
or:
pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf
” -
Thank you.
I used pdftk *.pdf cat output combined.pdf
to create a single pdf from 160 individual pages.
I had to renumber and re-pad the number sequence. I did not see how to do that in Linux so I went to WinDoz and used Ulead which did it nicely.
Thanks again for the suggestion of pdftk.

Combine multiple PDFs into one file « Universe_JDJ’s News Blog on 01 Jan 2007 at 6:43 pm
[…] read more | digg story […]