【发布时间】:2012-01-10 21:00:44
【问题描述】:
我正在努力在 tcpdf 中获得准确的定位。我试图在多个地方使用 SetMargins() ,但我一定误解了这种方法的用法。 它似乎没有像我预期的那样工作。
$pdf->SetFont('helvetica', '', 12);
$pdf->AddPage();
$pdf->SetMargins(10, 10, 10, true); // set the margins
$html = 'Here is some text';
$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'L', true);
$pdf->SetMargins(0, 10, 0, true); // put space of 10 on top
$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'C', true);
$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'R', true);
$pdf->Output('example_002.pdf', 'I');
我肯定会得到一个输出,但我希望第一个和第二个 writeHTMLCell() 能够重置它们之间的空间。
http://www.tcpdf.org/doc/classTCPDF.html#ab3bbdb7c85ea08d175fd559be6132ba0
文档说第二个参数是上边距。
简而言之,如果有必要,我想弄乱每一行的边距。但我可能为此使用了错误的方法。 我上面的示例似乎完全忽略了该参数。但是左右参数好像没有问题。
【问题讨论】:
标签: tcpdf