Greenhorn Greenhorn - 1 month ago 29
MySQL Question

Page break in Html2Pdf

I am in the process of generating a dynamic pdf file, which contains data of around 10,000 users, in general the app is developed using MySQL and PHP. The dynamic content is so heavy that, I found it difficult to process with

fpdf()
class. So I converted my output PHP page as a HTML file using
ob_get_clean()
. Now the html file is generated successfully and also the pdf file. But i want to leave a page break after each user's data, that is every user's data must start in a fresh page. I couldn't use any HTML tags because, in the dynamically generated HTML file, everything is out of the
<html>
and
</html>
tags. Please help me so that some how i make a page break in the pdf file after every user's data... Thanks in advance :)

Answer

i just figured this out after having the same problem. the parser that they use DOES support the page-break-after tag, but the html2pdf does not work.

i think i have it working by doing the following modifications to html2pdf.class:

around line 4174, the first thing inside:

protected function _tag_close_P($param){

should be:

   if($this->parsingCss->value['page-break-after'] == "always")
        $this->_setNewPage();

around line 2961, the first thing inside:

protected function _tag_close_DIV($param, $other='div'){

should be:

 if($this->parsingCss->value['page-break-after'] == "always")
        $this->_setNewPage();