How to merge pdf:s using Imagemagick (resolution problem)

When I try to merge two .pdf files using Imagemagick

convert pdf1.pdf pdf2.pdf temp.pdf

the resulting temp.pdf file seems to have very low resolution. How can I keep the resolution same as in the source files?


Solution 1:

Barns's right, but if pdftk didn't work try ghostscript.

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=temp.pdf pdf1.pdf pdf2.pdf

Solution 2:

If every file you want to merge is in the same folder:

convert -density 150 $(ls -rt *pdf) output.pdf

the argument -density 150 keeps the quality of the merged PDFs.

Solution 3:

Imagemagick's convert command is normally used for converting image files from one format to another, and in this case, it is possible that it is actually performing an internal conversion of sorts before outputting the two "images" (PDFs) into a single file.

I would suggest you consider using the PDF Toolkit (pdftk) instead http://www.accesspdf.com/pdftk/

From the examples on the website, this should be as simple as:

pdftk pdf1.pdf pdf2.pdf cat output temp.pdf