PHP 7 HTML2PDF.js Example to Add Page Break inside PDF Document in Browser Using Javascript

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments



html2pdf supports page tag:

at line 2229. You can see there what attributes are supported. For example following creates one page in landscape and one in portrait mode:



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:

parsingCss.class.php Line 114:

Line 1024 add a new handler to the switch case:

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


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:

should be:

around line 2961, the first thing inside:

should be:

Leave a Reply