title: PHP: add external pdf page to generated pdf using mPDF
body: <p>I'am using mPDF to generate the first page of a pdf using a template file, and I need to add an external (single paged) pdf file to the second page.</p>
  
  <p>For that I download the external pdf file to /tmp directory and I use this code found in mPDF github manual (<a href="https://mpdf.github.io" rel="nofollow noreferrer">https://mpdf.github.io</a>):</p>
  
  <pre><code>$loPdf-&gt;SetImportUse();
  // getOriginInvoice returns the path of the tmp pdf file downloaded
  $lsFile = $this-&gt;getOriginInvoice($loBill);
  if (!empty($lsFile)) {
      $liNbpages = $loPdf-&gt;SetSourceFile($lsFile);
      for ($liPage = 1; $liPage &lt;= $liNbpages; $liPage++) {
          $loPdf-&gt;UseTemplate($loPdf-&gt;ImportPage($liPage));
      }
  }
  $loPdf-&gt;Output('/data/tmp/test.pdf');
  </code></pre>
  
  <p>After running this code the test.pdf file contains only the first generated page !</p>
  
  <p>I tried to create a new pdf file and import the external file and it works,  but when I try to add the pdf file to the generated one it doesn't work !</p>
  
  <p>So that's why I need your help guys, I tried all the solutions that I found !!</p>