<?php
  
  // This code takes the output buffer's contents
  // created in the mPDF Single Page Header Include
  // code block and outputs a PDF to the browser.

  // capture output buffer
  $html = ob_get_flush();
  
  // erases the buffer, turns it off
  ob_clean ();
  
  // https://mpdf.github.io/reference/mpdf-functions/construct.html

  
$mpdf = new \Mpdf\Mpdf([
    'mode' => 'utf-8',
    'format' => 'letter',
    'orientation' => 'P',
    'margin_left' => 10,
    'margin_right' => 10,
    'margin_top' => 10,
    'margin_bottom' => 10
]);

  
  $mpdf->SetDisplayMode('fullpage');
  
  // options
  $mpdf->SetTitle("Form Page");
  
   // (Optional) Security.
  

  $mpdf->WriteHTML($html);
  
  $mpdf->Output('Form Page.pdf', 'I'); // page title, output mode
  
  // Optional
  //clear_fb_session();
  
  exit;
  
?>