title: How to use mpdf in codeigniter?
body: <p>controller: function pdf_question()</p>
  
  <pre><code>public function pdf_question()
  {
      $data = [];
      $pdfFilePath = "output_pdf_name.pdf";
      $this-&gt;load-&gt;library('m_pdf');
      $this-&gt;m_pdf-&gt;pdf-&gt;WriteHTML($this-&gt;load-&gt;view('pdf-question'));
      $this-&gt;m_pdf-&gt;pdf-&gt;Output($pdfFilePath, "D");  
  }
  </code></pre>
  
  <p>view: </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="container"&gt;
          &lt;div class="col-lg-12" style="background:#38558a;"&gt;
              &lt;h3 style="color:#ff7900;"&gt;&lt;b&gt;Quiz Questions&lt;/b&gt;&lt;/h3&gt;
              &lt;hr&gt;
          &lt;/div&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-md-12"&gt;
              &lt;br/&gt; 
                  &lt;div class="login-panel panel panel-default"&gt;
                      &lt;div class="panel-body"&gt; 
                          &lt;a href="javascript:void(0)" class="btn btn-danger" style="float:right;" id="pdf"&gt;PDF&lt;/a&gt;
                          &lt;div class="col-lg-12" id="target"&gt;
                              &lt;?php
                                  $this-&gt;db-&gt;select('*');
                                  $this-&gt;db-&gt;from('qbank');
                                  $query = $this-&gt;db-&gt;get();
                                  $result = $query-&gt;result_array();
                                  foreach($result as $row)
                                  {
                                      $qid = $row['qid'];
                                      $question = $row['question'];
                              ?&gt;
                                      &lt;div class="col-div-container"&gt;
                                          &lt;table class="bix-tbl-container" width="100%" cellspacing="0" cellpadding="0" border="0"&gt;
                                              &lt;tbody&gt;
                                                  &lt;tr&gt;
                                                      &lt;td rowspan="2" valign="top" align="left"&gt;&lt;?php echo $qid; ?&gt;.&amp;nbsp;&lt;/td&gt;
                                                      &lt;td valign="top"&gt;&lt;p&gt;&lt;?php echo $question; ?&gt;&lt;/p&gt;&lt;/td&gt;
                                                  &lt;/tr&gt;
  
                                                  &lt;tr&gt;
                                                      &lt;td valign="top"&gt;
                                                          &lt;table width="100%" cellspacing="0" cellpadding="0" border="0" style="line-height: 1.7;"&gt;
                                                              &lt;tbody&gt;
                                                                  &lt;?php 
                                                                      $this-&gt;db-&gt;select('*');
                                                                      $this-&gt;db-&gt;from('options');
                                                                      $where = "qid = '$qid'";
                                                                      $this-&gt;db-&gt;where($where);
                                                                      $sql = $this-&gt;db-&gt;get();
                                                                      //echo $this-&gt;db-&gt;last_query();
                                                                      $res = $sql-&gt;result_array();
                                                                      foreach($res as $rows)
                                                                      {
                                                                          $option = $rows['q_option']; 
                                                                  ?&gt;
                                                                  &lt;tr&gt;
                                                                      &lt;ol style="list-style-type: upper-alpha;"&gt;
                                                                          &lt;td width="5%"&gt;
                                                                              &lt;li&gt;&lt;a href="javascript:void(0)"&gt;&lt;input type="radio" name="radio_btn"&gt;&lt;/a&gt;&lt;/li&gt;
                                                                          &lt;/td&gt;
                                                                      &lt;/ol&gt;
                                                                      &lt;td width="99%"&gt;&lt;?php echo $option; ?&gt;&lt;/td&gt;
                                                                  &lt;/tr&gt;
                                                                  &lt;?php
                                                                      }
                                                                  ?&gt;
                                                              &lt;/tbody&gt;
                                                          &lt;/table&gt;
                                                      &lt;/td&gt;
                                                  &lt;/tr&gt;
                                              &lt;/tbody&gt;
                                          &lt;/table&gt;
                                      &lt;/div&gt;
                                      &lt;hr/&gt;
                              &lt;?php
                                  }
                              ?&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In this code I have created a view file having name pdf-question.php and now I want to export these question into pdf formate for this I am using mpdf codeigniter where I have load M_pdf.php library and mpdf in third party but Its not working it show me an error and i.e. </p>
  
  <pre><code>HTML contains invalid UTF-8 character(s)
  mPDF error:
  </code></pre>
  
  <p>So, How can I fix this issue ?Please help me.</p>
  
  <p>Thank You </p>