title: how TCPDF prevent the extra blank page
body: <p>I have create class to make page by using TCPDF. </p>
  
  <p>I need to convert HTML to pdf, so I using <code>writeHTML</code> and <code>AcceptPageBreak()</code>.  </p>
  
  <p>The <code>$html</code> is Dynamically changed, could be very long.</p>
  
  <pre><code>class MY_TCPDF extends TCPDF{
      public function makePage($html){
          $head_image="header.jpg";
          $this-&gt;SetMargins(PDF_MARGIN_LEFT, 70, PDF_MARGIN_RIGHT);
          $this-&gt;setPrintHeader(false);
          $this-&gt;AddPage();
          // get the current page break margin
          $bMargin = $this-&gt;getBreakMargin();
          // get current auto-page-break mode
          $auto_page_break = $this-&gt;getAutoPageBreak();
          // disable auto-page-break
          $this-&gt;SetAutoPageBreak(false, 0);
          // set bacground image
          $img_file = $head_image;
          $this-&gt;Image($img_file, 0, 0, 210, 68, '', '', '', false, 300, '', false, false, 0);
          // restore auto-page-break status
          //$this-&gt;SetAutoPageBreak($auto_page_break, PDF_MARGIN_BOTTOM);
          // set the starting point for the page content
          $this-&gt;setPageMark();
          $this-&gt;writeHTML($html, true, false, true, false, '');
          $this-&gt;lastPage();
  
  
          ob_start();
          //Close and output PDF document
          $this-&gt;Output('my.pdf', 'I');
          ob_end_flush();
      }
  
      public function AcceptPageBreak() {
          $this-&gt;SetMargins(PDF_MARGIN_LEFT, 10, PDF_MARGIN_RIGHT);
          $this-&gt;AddPage();   
          return false;
      }
  }
  </code></pre>
  
  <p>The problem is I genenrate PDF, but alway has a extra blank page in the end of the PDF.</p>
  
  <p>I tried use <code>$this-&gt;delete($this-&gt;getPage())</code> ,but it only remove last page which has content and the extra blank page remain. this seems <code>writeHTML</code> will create a page break after it. </p>
  
  <p>how to prevent this extra blank page?</p>