Imagemagick combine 2 generated PDFs into 1 multi-page file

imagemagickmultipagepdf

I'm not finding in the documentation where to take 2 PDFs and combine them into 1 file where image1.pdf will be page 1 and image2.pdf will be page2.

Is this even possible?

I see documentation where you can pull images and do a lot of processing FROM a multi-page PDF but not on how to combine them.

**This seems to have worked but with major loss of quality. I'm sure there is a way to combine without touching PDF quality, density, degradation, etc.

exec("convert image1.pdf image2.pdf combined.pdf");

Best Answer

If the imagemagick on your server is able to manipulate the pdfs at all it must be using the ghostscript delegate under the hood. Try the answer used here first using ghostscript directly for best results.

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