title: Creating PDF in Laravel 5.2 using html2pdf
body: <p>I am trying to generate a PDF in Laravel 5 using spipu pdf but have not succeeded. How do I go about it?</p>
  
  <p>That is my code segment:</p>
  
  <pre><code>public function download_pdf()
  {       
    try {
    ob_start();
    include  'resources\views\retailer_dashboard\procurement\invoice.blade.php';
    $content = ob_get_clean();
  
    $html2pdf = new Html2Pdf('P', 'A4', 'fr');
    $html2pdf-&gt;setDefaultFont('Arial');
    $html2pdf-&gt;writeHTML($content);
    $html2pdf-&gt;Output('/download_pdf.pdf');
  }
  catch (Html2PdfException $e) 
  {
      $formatter = new ExceptionFormatter($e);
      echo $formatter-&gt;getHtmlMessage();
      }
  
  }
  </code></pre>