Cannot set margins with SetMargins
Guidelines
- [X] I understand that if I fail to provide all required details, this issue may be closed without review.
Description of the bug
SetMargins does not support margin-bottom as the constructor config does, plus margin-left and margin-right are not taken into consideration.
This how I fixed the output in my project https://github.com/elaborate-code/row-bloom/commit/683fcd483b428328280fd43263f261afce2b98b6
mPDF version
v8.1.6
PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
PHP 8.1.6 (Simply running a script with php ./script.php)
Reproducible PHP+CSS+HTML snippet suffering by the error
// script.php
use Mpdf\HTMLParserMode;
use Mpdf\Mpdf;
$mpdf = new Mpdf();
$mpdf->SetMargins(50,50,50);
$mpdf->SetHeader('foo');
$mpdf->SetFooter('foo');
$mpdf->WriteHTML('<p>foo</p>');
$mpdf->WriteHTML('', HTMLParserMode::HEADER_CSS);
$mpdf->OutputFile(__DIR__.'./bar.pdf');
It seems that SetMargins is a method taken over from FPDI, not documented and not (even unofficially) supported in mPDF. Use other methods of setting margins - as parameters of Mpdf\Mpdf constructor, parameters of AddPage/AddPageByArray or by properties of <pagebreak> tag. The SetMargins method will eventually be deprecated and removed.