title: PHP mPDF save file as PDF
body: <p>I have a page which uses mPDF which when you run displays a PDF in the browser, it can also be saved from here as a PDF no problem. What I would like to happen is when the page is run and generates a PDF that the page is saved as a PDF on the server.</p>
  
  <p>Here is the current code:</p>
  
  <pre><code>&lt;?php
  include $_SERVER['DOCUMENT_ROOT'].'/include/seo-check/lib/WSAclient.php';
  include $_SERVER['DOCUMENT_ROOT'].'/include/seo-check/lib/WSAParser.php';
  
  $reportID= $_GET['reportid'];
  
  $WSAclient = new WSAclient(WSA_USER_ID,WSA_API_KEY);
  
  $result=$WSAclient-&gt;viewReport($reportID,WSA_SUBSCRIPTION_ID,'xml','EN');
  
  unset($WSAclient);
  
  ob_start();
  ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;PDF Report&lt;/title&gt;
  &lt;!--Add your CSS here--&gt;
  &lt;/head&gt;
  &lt;body&gt;    
  &lt;?php  
  echo WSAParser::viewReportResponse($result);
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  $HTMLoutput = ob_get_contents();
  ob_end_clean();
  
  
  //Convert HTML 2 PDF by using MPDF PHP library
  include $_SERVER['DOCUMENT_ROOT'].'/include/seo-check/lib/MPDF/mpdf.php';
  $mpdf=new mPDF(); 
  
  $mpdf-&gt;WriteHTML($HTMLoutput);
  $mpdf-&gt;Output();
  ?&gt;
  </code></pre>
  
  <p>Like I said this outputs the PDF fine but could someone tell me how to save as a PDF?</p>