title: Mpdf use pdf template to create new pdf document
body: <p>How to use "sample.pdf" as template to create new pdf document with Mpdf?</p>
  
  <p>We have <strong>one page</strong> pdf template with large number of placeholders and we want to populate them.</p>
  
  <p>We start learning with trying to generate copy of template without any data.</p>
  
  <pre><code>    $this-&gt;mpdf = new Mpdf(); 
  
      $this-&gt;mpdf-&gt;SetDisplayMode('fullpage');
      $this-&gt;mpdf-&gt;SetCompression(false);
      $this-&gt;mpdf-&gt;SetSourceFile(APP . 'Template' . DS . 'Pdf' . DS . 'sample.pdf');
      $tpl = $this-&gt;mpdf-&gt;ImportPage(1); // *
      $this-&gt;mpdf-&gt;AddPage(); // *
      $this-&gt;mpdf-&gt;useTemplate($tpl); // *
  
      $this-&gt;mpdf-&gt;Output(TMP . 'test.pdf');
  </code></pre>
  
  <p>But "test.pdf" is blank.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Our sample.pdf has 911KB size, our test.pdf 1KB, but when comment lines // * our test.pdf have same size as sample.pdf but doc is blank / white page.</p>
  
  <p><strong>UPDATE with working code</strong> we have read other tuts. </p>
  
  <pre><code>    $this-&gt;mpdf-&gt;SetImportUse();
      $this-&gt;mpdf-&gt;SetDocTemplate(APP . 'Template' . DS . 'Pdf' . DS . 'sample.pdf', true);
      $this-&gt;mpdf-&gt;AddPage();
  
      $this-&gt;mpdf-&gt;Output(TMP . 'testpdf.pdf');
  </code></pre>