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: Do not restore block elements after a pagebreak

Default: false

Values of 1 or 0 can also be used

Changelog

Version Description
2.3 The variable was added.
6.0 The variable was removed.

Examples

<?php
$mpdf = new \Mpdf\Mpdf();

$mpdf->restoreBlockPageBreaks = true;

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

See Also

  • WriteHTML() - Write HTML code to the document
  • <formfeed> - Equivalent to pagebreak with $restoreBlockPageBreaks set to true
Fork me on GitHub