Reputation: 391
Although the HTML is generated in a fixed static layout with its own CSS, the HTML gets distorted if rendered with mpdf into a pdf-file.
$mpdf = new Mpdf([
'mode' => 'utf-8',
'format' => [460, 405], // should be big enough to fit
'orientation' => 'P',
]);
$mpdf->AddPageByArray([
'margin-left' => 0,
'margin-right' => 0,
'margin-top' => 0,
'margin-bottom' => 0,
]);
$mpdf->WriteHTML($data);
$mpdf->Output($filename . '_EZ.pdf', 'I');
The HTML is generated based on the following template
What causes this behavior in mpdf?
Upvotes: 0
Views: 656
Reputation:
Well mpdf is very specific about what css tags you can use and what html tags to use where. I recommend going through the manual. But the biggest problem I see is using divisions in the table. Mpdf doesn't support that. Look at supported tags in the documentation.
I recommend rewriting the entire template read through the docs and first test only half of your design etc.
But to give you a couple of pointers that helped me.
<span class="some-class">Value</span></br>
<span class="some-class">Line2</span></br>
Upvotes: 2