如何在FPDF中居中放置文本? [英] How to Center Text in FPDF?

查看:69
本文介绍了如何在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆