title: Hide loader when Pdf generation finishes with mpdf in Codeigniter
body: <p>In Codeigniter, I am generating a pdf using mPDF library. On button click, I show the loader using javascript as below:</p>
  
  <pre><code>&lt;button  onclick="showloader()" class="btn btn-block btn-primary"&gt;&lt;i class="fa fa-file-pdf-o"&gt;&lt;/i&gt; Print to PDF&lt;/button&gt;
  </code></pre>
  
  <p>This buttons does a postback to a Controller which passes the control to a model function. Inside this model function I have fetch information from databse and generated a PDF from the same</p>
  
  <pre><code>$mpdf = new \Mpdf\Mpdf();
  $mpdf-&gt;showImageErrors = true;
  $mpdf-&gt;WriteHTML($a);
  $mpdf-&gt;Output('Filename.pdf', 'D');
  </code></pre>
  
  <p>Js functions:</p>
  
  <pre><code>function loader()
  {
      $('#loading').show();
  }
  function hideloader()
  {
      $('#loading').hide();
  }
  </code></pre>
  
  <p>How can I call the javascript hideloader() function after this line so that loader gets hidden: </p>
  
  <blockquote>
    <p>$mpdf->Output('Filename.pdf', 'D');</p>
  </blockquote>