title: mutliple pdf generation with mpdf, display utf-8 charset,
body: <p>My project should generate multiple forms as pdf, I am using mpdf library with codeigniter framework. I test this code with english language it works fine. However I should create forms with persian language. The first form is created without any problem but the others are not displaying well the characters(as in picture). Please help me, I tried my best and searched a lot but could not find any solution for my issue.
  This is the correct one<img src="https://i.stack.imgur.com/oNCZL.jpg" alt=""></p>
  
  <p>all of the remaining pdfs without the first pdf have this problem<img src="https://i.stack.imgur.com/WJrTW.jpg" alt=""></p>
  
  <pre><code>require('my_controller.php');
  $file_c = new File_Controller();
  $file_c-&gt;create_file(/*parameters here*/);//creates one pdf file
  $file_c-&gt;mfiles(/*parameters*/);//create more than one pdf file
  </code></pre>
  
  <p>because it is required to create the original file separately I use multiple forms.</p>
  
  <p>I set the charset and direction to the html code. the following is the code that I used to generate pdf. </p>
  
  <pre><code>$this-&gt;load-&gt;library('m_pdf');
  $mpdf=new mPDF('utf-8');
  $mpdf=new mPDF('ar','A4','','',32,25,27,25,16,13);
  $mpdf-&gt;debug = true;
  $mpdf-&gt;SetDirectionality('rtl');
  $mpdf-&gt;mirrorMargins = true;
  $mpdf-&gt;WriteHTML($MyhtmlCode );
  $mpdf-&gt;Output($thepath, "F");
  </code></pre>
  
  <p>The first pdf after creation should be opened in the browser. When I open it in windows (internet explorer or firefox) the pdf file can not open. but in mac it can be open in a browser.</p>
  
  <pre><code>header("Content-type: application/pdf");
  header("Content-Length: " . filesize($file));
  echo read_file($file);
  </code></pre>
  
  <p>(I used the same syntax and code for all pdfs and functions.)</p>