如何解决如何使 css 在 tcpdf 中工作?
我想在我的tcpdf中实现使用css自动给我的表格行编号的功能。我不知道为什么它不起作用。我确实在常规网站上查看过它,它运行良好。但我不知道为什么当我将它添加到我的 tcpdf 时它根本不起作用。有谁知道这个问题的解决方案?请帮我。任何建议将被认真考虑。提前致谢。
$htmlcontent .= '<style>
table {
counter-reset: rowNumber;
}
table tr.receiptcontent::before {
display: table-cell;
counter-increment: rowNumber;
content: counter(rowNumber) ".";
}
</style>';
$htmlcontent .='
<table cellpadding="11" style="max-height: 1000px;">
<tr class="receiptcontent">
<td colspan="3" style="font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
'.$irow['product_title'].'
</td>
<td style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
'.$irow['product_sku'].'
</td>
<td style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
'.$irow['quantity'].' '.$irow['quantity_unit'].'
</td>
<td style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
RM '.$irow['product_buy_price'].'
</td>
<td width= "20%" style=" font-weight: normal;font-size: 12px;line-height: 17px;color: #000000;">
RM '.$irow['purchase_price'].'
</td>
</tr>
</table>
';
}
解决方法
在将 HTML 发送到 TCPDF 时内联 CSS
或
将您的 css 添加到单独的 css 文件中并将其包含在 html 中:
eg: $htmlcontent .='<style>'.file_get_contents('./style.css').'</style>';
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。