我想用html表创建pdf:
所以,我创建了这个html:
<table style="width: 100%; border:2px solid; border-collapse: collapse; padding: 0; margin: 0;">
<tr style="border-bottom: 1px solid;">
<th style="border-left: 1px solid; width: 60%;">Ref produit</th>
<th style="border-left: 1px solid; width: 10%;">Taille</th>
<th style="border-left: 1px solid; width: 10%;">Quantit�</th>
<th style="border-left: 1px solid; width: 10%;">Prix net HT</th>
<th style="border-left: 1px solid; width: 10%;">Montant HT</th>
</tr>
<tr>
<td style="border-left: 1px solid;">BAL100</td>
<td style="border-left: 1px solid; text-align: center;">S</td>
<td style="border-left: 1px solid; text-align: center;">20</td>
<td style="border-left: 1px solid; text-align: center;">22.00</td>
<td style="border-left: 1px solid; text-align: center;">440</td>
</tr>
<tr>
.
.
.
</tr>
</table>
pdf结果为:
边界不见了!
如果我删除该属性border-collapse: collapse;
,则会显示边框,但结果不合适。
我在官方论坛(法语帖子)上看到属性border-collapse仅适用于标记table
。所以我不明白为什么我的表生成不正确。
任何的想法?
这是我的PHP代码生成PDF
$html2pdf = new HTML2PDF('P','A4','fr');
$html2pdf->WriteHTML($htmlContent);
$html2pdf->Output($path, 'F');
border-collapse: collapse;
应该将两个相同的相邻边界合并在一起。在html2pdf中使用它时,应该同时设置border-left
和border-right
属性的样式(相同的东西),折叠时将产生单个边框。另外,要防御性地编写此CSS而不假定border-color
属性继承,则应在定义边框时从技术上指定它,例如border: 1px solid black;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句