forcePortraitMargins
mPDF ≥ 2.3
Special case - rotated margins on Landscape pages
Default: false
If default page orientation is P
(Portrait
), then adding new page L
(Landscape
) causes the left/right margins to
be used as top/bottom, and vice-versa.
(NB similar to forcePortraitHeaders which does the same but also rotates the HTML headers/footers.)
NB - if using OddEven (double-sided document), it is the Portrait orientation L/R margins that alternate.
When adding a page, you must only call $mpdf->AddPage('L')
or <pagebreak orientation="landscape" />
.
If you try to set new margins/headers etc. for new landscape pages when forcePortraitMargins = true
, it will go wrong.
Usage
Set at document initiation
<?php
// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf(['forcePortraitMargins' => true]);