title: Join multiple PDF files into a single page PDF - positioned join using PHP
body: <p>This is not an attempt to join separate PDFs to one single PDF with multiple pages. It is an attempt to create a single page PDF from few other PDFs that already exists. I need to do this using PHP and the server is CentOS.</p>
  
  <p>I am already generating a set of single page PDF files based on individual templates (Using FPDF). The requirement is to allow the user to mix and match existing PDF files and position them together to create a single PDF.</p>
  
  <p><img src="https://i.stack.imgur.com/aBgf9.png" alt="join multiple PDFs using dynamic positions to single page PDF"></p>
  
  <p>My current attempt is to convert the PDFs to images (using ghostscript) and use the output jpegs to create the final PDF using FPDF. While this is possible, the quality of the PDF is compromised a little during conversion.</p>
  
  <p>I would like to know if there is a better solution that we can use?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The solution doesn't have to be PHP. It most probably wont be. I'm certainly up for any commandline tool that can do the job. Example command would be as follows:</p>
  
  <p><code>$ newtool -o outfile.pdf -s WidthXHeight -i in1.pdf in2.pdf in2.pdf -g p1Xp2 p3Xp4 p5Xp6</code></p>
  
  <p>Above is an example only - not a real command - I just wish if a tool has that kind of functionality. Specify set of input files and their positions on the output file.</p>