FPDF:的恼人的错误。MultiCell()[英] Annoying bug of FPDF :: MultiCell()

本文是小编为大家收集整理的关于FPDF:的恼人的错误。MultiCell()的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我刚刚遇到了一个非常奇怪的FPDF错误.我的代码是:

$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'); 

用于中心对齐.我得到的,在以下屏幕截图上呈现: net/uploads/fpdf9rwucik1xh.png 分别使用"右"和"中心"对齐.它不是绝对的,而是相对于多电池的正确边界.

更重要的是,自动线路断开不起作用.

刚刚注意到,单元格方法中也存在相同的对齐错误.

浪费了两个小时,我在互联网上什么也没发现. 请帮助修复.

推荐答案

找到解决方案.我必须设置任何字体.

说实话,这很烦人.但是,如果其他人遇到同样的问题,就不会再浪费时间了!

本文地址:https://www.itbaoku.cn/post/2090935.html

问题描述

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'); 

for right alignment and the same:

$PDF->MultiCell(40, 5, "WE WANT TO SERVE YOU BETTER", 1, 'C'); 

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!