Currently I am using ImageMagick to merge multiple PDFs into one in a PHP script on my Linux system. However, the resulting PDFs are of very low quality. I have stumbled across pdftk which seems to have a better quality after the merging, but I need to use ImageMagick if possible because I need to get the script to run on another server which does not have pdftk (and it would be a pain to get it on there).
How can I merge PDFs using ImageMagick and PHP with lossless quality?