title: HTML+PDF to PDF output using PHP
body: <p>I've managed to convert an HTML page to PDF document data.  Now, I'm adding an upload for PDFs to be included in this document data.  I'm looking to find the best way to do this and haven't found anything that works just right.  Here are the specifics:</p>
  
  <ul>
  <li>The HTML makes up half the page and the uploaded PDF must be appended starting on this page.</li>
  <li>If the PDF appended is longer than half a page, it continues onto the second (no page break between the HTML content and PDF content.</li>
  <li>Multiple page PDFs are fully included (once I have a good solution, I can figure this part out).</li>
  </ul>
  
  <p>I've tried a few different approaches, each with their own drawbacks:</p>
  
  <ul>
  <li>Conversion of PDF to HTML and combined with original HTML.  Tons of formatting issues.  If the client keeps the formatting simple, this isn't a problem (but we all know that's not going to happen).</li>
  <li>Simply appending the PDF to the PDF output.  Starts the append on page 2, not page 1.</li>
  <li>Dumping the PDF into an image and placing an image tag in the HTML.  Prettiest results but requires cropping of whitespace and pushes anything longer than half a page onto the second.</li>
  </ul>
  
  <p>I'm using DOMPDF for the HTML to PDF conversion.  For I've tried PDFLib, FPDI and ImageMagick/GhostScript (image conversion).  Maybe this is a shot in the dark, but does anyone know of a better way?</p>