mPDF Manual – Paging

Page size & Orientation

Page sizes supported

When declaring an instance of mPDF class, you can specify the (default) page size and orientation for the document. The margins and orientation can be redefined throughout the document whenever you add a new page using AddPage() or <pagebreak>. It can also be set by CSS using @page.

Examples

Example #1

<?php

$mpdf = new mPDF('', 'Legal');

$mpdf->WriteHTML('
Hallo World
');

$mpdf->AddPage('L'); // Adds a new page in Landscape orientation

$mpdf->WriteHTML('
Hallo World
');

$mpdf->Output();

?>

Example #2

<?php

// Define a default Landscape page size/format by name

$mpdf = new mPDF('utf-8', 'A4-L');

// Define a default page size/format by array - page will be 190mm wide x 236mm height

$mpdf = new mPDF('utf-8', array(190,236));

// Define a default page using all default values except "L" for Landscape orientation

$mpdf = new mPDF('','', 0, '', 15, 15, 16, 16, 9, 9, 'L');

See Also