如何在FPDF中居中放置文本? [英] How to Center Text in FPDF?
问题描述
如何使生成的文本显示在页面的中心位置.
How can I have this generated text appear centered in the page.
Generated = $ _ POST
方法...所以我不知道输入文本会持续多长时间.我需要以某种方式预先确定一个中心参数.
Generated = $_POST
method ... so I don't know how long will the text in input be. I need to have a pre-determined center parameter somehow.
有什么想法吗?也许是这样的:
Any ideas? Maybe like this:
MultiCell(0,$height,"text",0,'C') ?
推荐答案
通常它是 $ pdf-> Cell(0,$ height,"text",0,0,'C');
,但如果您在Header或Footer函数中执行此操作,则它是 $ this-> Cell(0,$ height,"text",0,0,'C')
.如果您在function()调用中这样做,请不要忘记将 $ height
声明为全局变量.
Normally it's $pdf->Cell(0, $height, "text", 0, 0, 'C');
but if you're doing it in a Header or Footer function it's $this->Cell(0, $height, "text", 0, 0, 'C')
. Don't forget to declare $height
as a global if you're doing this in a function() call.
这篇关于如何在FPDF中居中放置文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!