title: I want to set header and footer in PDF using mpdf
body: <p>I have generated a PDF using <code>mpdf</code> library in CodeIgniter. I want to attach header image and footer image with proper margin, I have created one code but header and footer get overlapped.</p>
  
  <pre><code>//controller
  $this-&gt;load-&gt;library('m_pdf');
      $param = '"","A4","","",0,0,100,0,6,3,"L"';
      $pdf = $this-&gt;m_pdf-&gt;load($param);
      // $pdf-&gt;useOddEven = true;
  
      $pdf-&gt;SetHTMLHeader('&lt;img src="' . base_url() . 'custom/Hederinvoice.jpg"/&gt;');
  
      $pdf-&gt;SetHTMLFooter('&lt;img src="' . base_url() . 'custom/footarinvoice.jpg"/&gt;');
      $wm = base_url() . 'custom/Watermark.jpg';
      $pdf-&gt;SetWatermarkImage($wm);
      $pdf-&gt;showWatermarkImage = true;
        $data['main_content'] = 'dwnld';
      $this-&gt;load-&gt;view('template', $data);
      $html = $this-&gt;load-&gt;view('template_pdf', $data, true);
      $this-&gt;load-&gt;view('template_pdf', $data, true);
      $pdf-&gt;WriteHTML($html);
      $pdf-&gt;page = 0;
      $pdf-&gt;state = 0;
      $pdf-&gt;Output($pdfFilePath, "D");
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Z8JUh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z8JUh.png" alt="enter image description here"></a></p>