1
I have an html that is automatically generated by a wysiwyg component (a text editor) and within one of the texts I generated, this one has a table and this table appears normally in html, however I need this table to appear in the pdf I am generating.
The PDF is coming out like this:
And I wanted it to come out like this, like in my html:
<?php
session_start();
include('mpdf60/mpdf.php');
$mpdf = new mPDF(
'', // mode - default ''
'', // format - A4, for example, default ''
0, // font size - default 0
'', // default font family
15, // margin_left
15, // margin right
58, // margin top
0, // margin bottom
6, // margin header
0, // margin footer
'L'); // L - landscape, P - portrait
$mpdf->SetDisplayMode('fullpage');
$paragrafo = "<p style=\"text-align:justify;line-height:150%\">
<span style=\"font-size: 12pt; line-height: 150%; font-family: Verdana, sans-serif; color: windowtext;\">
<!--<o:p> </o:p>-->
</span>
</p>
<table class=\"table\" border=\"2\" cellspacing=\"1\" cellpadding=\"1\" style=\"width: 940px;\" align=\"\">
<tbody>
<tr>
<td style=\"text-align: center;\">
<span style=\"font-size: large; background-color: rgb(153, 153, 153);\">2. OBJETIVO</span>
</td>
</tr>
</tbody>
</table>";
$mpdf->WriteHTML($paragrafo);
$mpdf->Output();
exit;
?>
Alexandre, try to generate this table outside the mpdf and then put it in, Oce does not need to use css inline, take a look at my answer about something similar: http://answall.com/questions/111332/como-creat-duas-divs-uma-ao-lado-da-outra-usando-mpdf/111348#111348
– Gabriel Rodrigues
actually this html I’m not doing, it’s a wysiwyg (a text editor) that does it, so I can’t control this inline css
– alexandre9865
and I didn’t understand what you meant by "generate this table outside the mpdf and then put in"@Gabrielrodrigues
– alexandre9865
You said that in html it is correct and in mpdf it is wrong, if you play the html result in a normal html file or in https://jsfiddle.net/ it will come out well formatted or not ? It’s that $paragraph
– Gabriel Rodrigues
yes, it exits correct in html file
– alexandre9865
But then how am I supposed to send it? which is in php that this is done, and are several texts, and not just this text, the variable $paragrafo joins the various texts, concatenating the
– alexandre9865
@Gabrielrodrigues unfortunately that’s not the problem, I put the html q ta giving problem, without the bars, in my php code and still does not appear in the generated pdf...
– alexandre9865