How do I position text in TCPDF using the XY coordinates of the bottom left of the text?

≡放荡痞女 提交于 2019-12-10 23:24:57

问题


I'd like to position text so that if the font size changes, the baseline of the text will stay the same.

When I use

$pdf->SetXY($x,$y);
$pdf->Write(0, "Hello"......);

This sets the position of the text at its top left.

Note: I am using write to render the text.


回答1:


I used the following syntax and am able to chose the absolute position to start the table.

$pdf->SetFont('verdana', 'B', 18);
$pdf->SetXY(15, 20);

$output = <<<EOD
<table cellspacing="0" cellpadding="1" border="0">
.....
$pdf->writeHTML($output, true, false, false, false, '');



回答2:


According to Example #57 and its showcase you have the option to use

$pdf->Cell(30, 0, 'Bottom-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'B', 'B');


来源:https://stackoverflow.com/questions/35506228/how-do-i-position-text-in-tcpdf-using-the-xy-coordinates-of-the-bottom-left-of-t

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!