0

我在tcpdf我的一个项目中使用生成 PDF 文件,它没有拾取 div 的边框。但是当我在相同的布局中使用表格时,它会拾取边框。

你能建议我在 tcpdf 中为 css 做什么吗?

或任何其他在 tcpdf 中包含 css 文件的方式

<div class="div_info" style="width:100%; float:left; padding:10px 0px;">
    <div style="padding:2px 0 0 0; margin:0px; float:left;"><p>Interior/Exterior BPO</p>'.$row->interior_exterior_form.'</div>
    <div style="padding:2px 0 0 0; margin:0px; float:left;"><p>Property Address:</p>'.$row->property_address.'</div>
    <div style="padding:3px 0 0 33px; margin:0px; float:left;"><p>Borrower(s):</p>'.$row->borrowers.'</div>
    <div style="padding:3px 0 0 35px; margin:0px; float:left;"><p>Loan/REO#:</p>'.$row->loan_number.'</div>
</div>

它只支持内联css吗?

在上面的布局中,如果我使用边框,那么它不会拾取它,但是如果我使用表格,那么它会在它周围添加边框。

4

1 回答 1

2
$html = <<<EOF
<style>   
    div.test {
        color: #CC0000;       
        border-style: solid;
        border-width: 1px;
        border-color: #000;
        text-align: center;
    }
</style>

<div class="test">This is your div content.</div>

<br />

EOF;

// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');

$pdf->lastPage();

$pdf->Output('sample.pdf', 'I');

有关更多详细信息,您可以访问此链接并查看示例 #61。

于 2012-10-04T05:22:08.557 回答