Reputation: 5
I noticed that float not working in mpdf. In pure html, code below work fine,
Help be appreciate, Thanks
<?php
$html = '
<html>
<head>
<style>
.section_left {
float : left;
width: 40%;
}
.section_right {
float : right;
width: 40%;
}
#customers
{
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: '.$font_taille_corps.'pt;
border-collapse:collapse;
border: 2px solid grey;
}
#customers tr {
background-color: #d7dce1;
border-top: 1px solid #fff;
height:30px;
}
</style> </head>
<body>';
$section_left = "<table id='customers' style='page-break-inside: avoid; ' class='section_left' ><tr><td>Hello world</td></tr></table>" ;
$section_right = "<table id='customers' style='page-break-inside: avoid; ' class='section_right' ><tr><td>Some others word</td></tr></table>" ;
//I don't want to put table in div, because MPDF slip data in 2 pages
$html.= $section_left.$section_right;
define('_MPDF_PATH','mpdf/');
include("mpdf/mpdf.php");
$mpdf=new mPDF('c','A4','','',20,15,50,25,10,5);
$mpdf->WriteHTML($html);
$mpdf->Output("test.pdf", "I");
exit;
[enter image description here] When printing, this is result, not I whant 1
Upvotes: 0
Views: 1979
Reputation: 6745
Floating for tables is not supported in mPDF.
For mPDF, I'd recommend using a single table with the two "subtables" as its cells (either as child table elements or as plain row/column combinations).
See https://mpdf.github.io/css-stylesheets/supported-css.html in mPDF documentation.
Upvotes: 1