php如何用FPDF将图像包装在表中

时间:2014-03-26 15:14:44

标签: php html css pdf fpdf

我有这个HTML

$html='<table width="100%" class="p" id="tblExport"><tbody>
    <tr><th>#</th><th>product</th><th>picture</th><th>product_category</th><th>avl_qty</th><th>promo_price</th><th>price</th></tr>    
<tr><td width="20" height="50">1</td><td width="250" height="50" class="left">Ladies bracelet SB25413</td><td width="80" height="50"><img width="60" src="../images/products/small/Ladies-bracelet-774-1.jpg"></td><td width="250" class="left">Leather bracelets</td><td width="150" height="50">3 br</td><td></td><td>37.00eur</td></tr>
<tr><td width="20" height="50">2</td><td width="250" height="50" class="left">Ladies bracelet SB20257</td><td width="80" height="50"><img width="60" src="../images/products/small/Ladies-bracelet-775-1.jpg"></td><td width="250" class="left">Bracelets with crystals</td><td width="150" height="50">32 br</td><td>15.00 eur</td><td>34.00eur</td></tr></tbody></table>';    

和php代码:

require('html_table.php');
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
$pdf->WriteHTML($html);
$pdf->Output();    

此代码输出以下内容: enter image description here

我如何包装图像? img宽度和td宽度显然不起作用..

1 个答案:

答案 0 :(得分:2)

将库更改为mpdf时删除了问题 - Nice解决方案,可自定义!