Note: mpdf 6.0
Hello,
I am trying to generate pdf's using mpdf that require precise positioning of elements for later printing purposes. The elements are to be drawn starting from the very top left corner of a given page, i.e. there should be no implicit paddings, margins, or other things that might affect the position of elements in the body.
Problem: mpdf appears to ignore CSS and values passed in constructor concerning margins/padding for the document root. The body is surrounded by margins in the PDF document (or the body is padding the child element). The stylesheet is indeed used by mpdf, though. Observation: the same HTML that is fed to mpdf along with the same stylesheet produces seemingly correct results in a browser (viewing the HTML).
$mpdf = new Mpdf([
//'debug' => true,
'format' => 'A4',
'margin_left' => 0,
'margin_right' => 0,
'margin_top' => 0,
'margin_bottom' => 0,
'margin_header' => 0,
'margin_footer' => 0
]);
... I've set paddings and margins to 0 wherever I could, especially:
body {
margin: 0mm;
padding: 0mm;
}
I don't know where I'm going wrong. Do you have suggestions as to how I might solve this problem?
As from the Mpdf docs for the constuctor function:
In V7.0 - "Parameters replaced with single $config parameter array"
You are using V6.0 try using comma separated values.
new \mPDF(x,x,x,x,x,x,etc)