A number of times I have faced the requirement of combining multiple PDF files into a single file. Doing that is fairly simple actually. It can be done using a number of tools. Two ways of doing it using tools very common on linux systems are as follows.
It takes a lot of options. For PDFs containing images, it is better to specify a quality parameter.
The above however reduces image quality badly. To get decent image quality with a little larger PDFs, we can use the following.
- Using Imagemagick
convert file1.pdf /path/to/file2.pdf /destination/path/store.pdf
It takes a lot of options. For PDFs containing images, it is better to specify a quality parameter.
convert -quality 100 mine1.pdf mine2.pdf merged.pdf
- Using Ghostscript
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input1.pdf input2.pdf
The above however reduces image quality badly. To get decent image quality with a little larger PDFs, we can use the following.
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input1.pdf input2.pdf
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=output.pdf input1.pdf input2.pdf