问题描述
我正在使用html创建pdf。下面是我的代码:
$pdf = new TCPDF(PDF_PAGE_ORIENTATION,PDF_UNIT,PDF_PAGE_FORMAT,true,'UTF-8',false);
$pdf->SetMargins(15,20,14,0);
$pdf->SetAutopageBreak(TRUE,0);
$pdf->setCellPaddings(0,0);
$pdf->setFooterMargin(0);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// add a page
$pdf->AddPage();
$html = '
<div style="background-color: #f8f8f8;">
<div style="font-size: 24px; color: #333; font-weight: 600; font-family:Arial,Helvetica,sans-serif;">Example</div>
<p style="color: #828282; font-size: 14px; font-family: sans-serif;">Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry standard dummy text ever since the 1500s,when an unkNown printer took a galley of type and scrambled it to make a type
specimen book. It has survived not only five centuries,but also the leap
into electronic typesetting,remaining essentially unchanged. It was popularised
in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,and more recently with desktop publishing software like Aldus PageMaker including
versions of Lorem Ipsum.</p>
</div>';
$pdf->writeHTML($html,false,'');
$pdf->Output('example_001.pdf','I');
由于某种原因,标题和文本之间会有空格
此外,每当我添加行高样式以在段落中的行之间留出一些空间时,它只会留下更大的空隙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)