mPDF Manual – mPDF Variables

autoPageBreak

(mPDF ≥ 3.1)

autoPageBreak – Specify whether to allow automatic page breaks

Description

void autoPageBreak

Specify whether to allow automatic page breaks. By default, mPDF creates page breaks when required in the document. Setting the value to false allows an oversized object (image etc.) to overwrite the footer and/or the bottom margin of the page.

Values

autoPageBreak => true|false

Values

  • true: enables automatic page breaks
  • false: disable automatic page breaks

Default: true

Changelog

Version Description
3.1 Variable was added.

Examples

<?php
// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf(['autoPageBreak' => false]);

$html = '<img src="largeimage.jpg" height="290mm" /> ';

$mpdf->autoPageBreak = false;

$mpdf->AddPage();

$mpdf->WriteHTML($html);
$mpdf->Output();

Fork me on GitHub