问题描述
我刚刚遇到了一个非常奇怪的FPDF错误.我的代码是:
I've just encountered a very strange bug of FPDF. My code is:
$PDF = new FPDF('P', 'mm', 'A4');
$PDF->SetXY(0,0);
$PDF->MultiCell(40, 5, "WE WANT TO SERVE YOU BETTER", 1, 'R');
用于右对齐和相同:
$PDF->MultiCell(40, 5, "WE WANT TO SERVE YOU BETTER", 1, 'C');
用于中心对齐.我得到的结果显示在以下屏幕截图中: http://img3.fotos-hochladen. net/uploads/fpdf9rwucik1xh.png 分别具有右侧"和中心"对齐方式.它不是绝对对齐,而是相对于多像元的右边界对齐.
for Center alignment. What I get, is presented on the following screenshot: http://img3.fotos-hochladen.net/uploads/fpdf9rwucik1xh.png with "right" and "Center" alignment respectively. It aligns not absolutely but relative to the right border of the multicell.
此外,自动换行符不起作用.
What's more, the automatic line break doesn't work.
只需注意,单元格方法中也存在相同的对齐错误.
Just noticed, same alignment bug is there also in the Cell method.
浪费了两个小时,我在互联网上什么也没发现.请帮助修复.
Having wasted two hours I found nothing on the Internet.Please help to fix.
推荐答案
找到解决方案.我必须设置任何字体.
Solution found. I had to set any font.
说实话,这很烦人.但是,如果其他人遇到相同的问题,也不会再为此浪费时间了!
To be honest, it was very annoying. But if someone else runs the same problem, will not any more waste time for that!
这篇关于FPDF的烦人错误:: MultiCell()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!