mPDF Manual – mPDF Variables

restoreBlockPagebreaks

(mPDF >= 2.3  <= 6.0)

Description

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.

Values

$restoreBlockPageBreaks = TRUE FALSE

Values

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

Changelog

Version Description
2.3 The variable was added.

Examples

Example #1

<?php

$mpdf = new mPDF();

$mpdf->restoreBlockPageBreaks = true;

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

$mpdf->AddPage();

$mpdf->WriteHTML('
Hallo World
</div></div>');

?>

See Also

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