Page break in Html2Pdf

后端 未结 4 570
野性不改
野性不改 2020-12-06 08:18

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

4条回答
  •  無奈伤痛
    2020-12-06 08:45

    Basing on macdabby's work (which doesn't work). But thanks to him, the idea is correct.

    Html2Pdf v4.03

    For example we want to parse a tag DIV:

    html2pdf.class.php line 2948:

    protected function _tag_close_DIV($param, $other='div')
    {
        if ($this->parsingCss->value['page-break-after'] == "always")
          $this->_setNewPage(null, '', null, $this->_defaultTop);
          $this->parsingCss->setPosition();
        ...
    }
    

    parsingCss.class.php Line 114:

    //add a new style declaration
    public function initStyle()
    {
        ...
        $this->value['page-break-after'] = null;
    }
    

    Line 1024 add a new handler to the switch case:

    case 'page-break-after':
        $this->value[$nom] = $val;
        break;
    

    And then for it to work, your html content should contain the break element

     

    Watch out for case sensitive style, not sure if the plugin handle it

提交回复
热议问题