Reputation: 401
Hi I am using mpdf for generating pdfs. Now I am facing problem with table border in html. I have following style for table in html
<table border="10" cellpadding="1" cellspacing="1" style="width: 500px;">
<tbody>
<tr>
<td>Test header</td>
<td>Test header</td>
</tr>
<tr>
<td>body</td>
<td>body</td>
</tr>
<tr>
<td>body</td>
<td>body</td>
</tr>
</tbody>
So the resulted pdf is not respecting the border size of the table. I attached the pdf. Please checj
Upvotes: 2
Views: 23520
Reputation: 423
I had the same problem until i realised i had $mpdf->simpleTables = true;
, borders showed up as soon as i set $mpdf->simpleTables = false;
Upvotes: 0
Reputation: 199
remove border="10"
and use border:10px solid
at style attribute for inline at <table>
tag, <tr>
and at <td>
tags also as mpdf will work on inline style sheet for all browsers.
Upvotes: 9
Reputation: 56391
I had to do the trick:
For A4 pages, I've created a 794x1122px image (example) , and set that image as a body background :
<?php
include_once(dirname(__file__).'/mpdf.php');
$mpdf=new mPDF( '', // mode (default '')
'A4', 0, '', // format ('A4', '' or...), font size(default 0), font family
15, 15, 16, 16, 9, 9, //(margins) left, right, top, bottom, HEADER, FOOTER
'L');
$texttt= '<html><head><style>
body {
background:url("./background1.png") ;
line-height:1.3em;
background-color: #F2F0EE;
}
</style></head><body>
My Textttttt
</body></html>';
$mpdf->WriteHTML($texttt);
$mpdf->Output('my_pdf_FILEEEEEE','F');
?>
Upvotes: -1
Reputation: 2128
You can try inline css
..
like
<table style="border:1px solid black;">
Upvotes: 0