title: Create new PDF from template with PHP
body: <p>I have a docx document file set up with formating and layout, which I saved as a PDF file.
  I want to use this pdf file as a template for creating new pdf files pre-filled with user data.</p>
  
  <p>I have seen <a href="http://www.fpdf.org/">FPDF</a>, <a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/">FPDI</a>, <a href="http://www.tcpdf.org">tcPDF</a>, <a href="http://code.google.com/p/dompdf/">domPDF</a>, <a href="http://framework.zend.com/manual/en/zend.pdf.html">Zend PDF</a>, <a href="http://koivi.com/fill-pdf-form-fields/">http://koivi.com/fill-pdf-form-fields/</a> (Justin Koivisto), a few convertion tools like <a href="http://html2pdf.fr/en/default">HTML2PDF</a> and a few command line tools mentioned here on stackoverflow. With the exception of <a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/">FPDI</a>, none of them offer an <strong>example</strong> using a PDF template to either search-and-replace custom tags with actual data (usually from a database) or add data without specifying a bunch of values like x, y, postion, font, font-formating etc.</p>
  
  <p>Creating a PDF from scratch seems like too much work.
  I have not yet considered using a <a href="http://html2pdf.fr/en/default">HTML2PDF</a> converter as the results appear to vary greatly, and then there is the issue with styling. Some tools allow CSS, but often with limits like no float support.</p>
  
  <p>Are there no easy way of using a template like there is for Excel with <a href="http://phpexcel.codeplex.com/">PHPExcel</a> ?</p>
  
  <p>My need is:</p>
  
  <ul>
  <li>Free</li>
  <li>Load and use a template</li>
  <li>Search-and-replace custom tags</li>
  <li>Add data (text, image, font, formating etc)</li>
  <li>Custom header and footer</li>
  <li>Must work with shared hosting</li>
  <li>Allow download, save/store to server and attach to email (preferable without having to save it first) of final generated PDF </li>
  </ul>