mPDF Manual – mPDF Variables


(mPDF >= 2.3  <= 6.0)


boolean restoreBlockPageBreaks

Specifies whether or not to restore open HTML block elements after a forced pagebreak. When a pagebreak is forced by AddPage() or <pagebreak>, mPDF by default will close any HTML block elements, expecting the HTML code to start afresh after the pagebreak. If this value is set to TRUE mPDF will attempt to carry over any CSS style values for the current block elements and continue after the pagebreak.


$restoreBlockPageBreaks = TRUE FALSE


TRUE: Restore block element properties after a pagebreak

FALSE: DEFAULT Do not restore block elements after a pagebreak

Values of 1 or 0 can also be used


Version Description
2.3 The variable was added.


Example #1


$mpdf = new mPDF();

$mpdf->restoreBlockPageBreaks = true;

$mpdf->WriteHTML('<div class="firstlevel"><div class="secondlevel">
Hallo World


Hallo World


See Also

  • WriteHTML() - Write HTML code to the document
  • <formfeed> - Equivalent to pagebreak with $restoreBlockPageBreaks set to TRUE