For a project estimate I did some research in loading in a pdf template, adding some images to it and saving it to a new pdf and preview images per page, using FPDF, FPDI and Imagemagick with Ghostscript.
A little something I found out recently :
when you’re writing a PHP script, you don’t need to end your file with closing tags.