title: CodeIgniter: Call to a member function WriteHTML() on a non-object
body: <p>I am getting this error when I an downloading a pdf file using MPDF. I am loading the code here below:</p>
  
  <pre><code>    $html = $this-&gt;load-&gt;view('customer/case_report',$this-&gt;data, true);
      $pdfFilePath = "output_pdf_name.pdf";
      $this-&gt;load-&gt;library('M_pdf');
      $this-&gt;M_pdf-&gt;pdf-&gt;WriteHTML($html);
      $this-&gt;M_pdf-&gt;pdf-&gt;Output('CaseReport_CaseNo_'.$caseNo.'.pdf', 'D');
  </code></pre>
  
  <p><strong>UPDATE</strong>
  Attaching screenshot here:
  <a href="https://i.stack.imgur.com/GTZKx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GTZKx.png" alt="The WriteHTML code in on line number 34"></a></p>
  
  <p>Any help will be greatly appreciated. Thank you</p>