【问题标题】:FPDF cell places text somewhereFPDF 单元格将文本放置在某处
【发布时间】:2020-08-29 09:52:18
【问题描述】:

我已经在这里阅读了很多案例,但没有任何建议的解决方案对我有用,因此我寻求一些提示/帮助。 我使用 FPDI/FPDF 的方法在单元格中放置文本,简而言之是:

public function placeTextCell($font, $fontSize, $x, $y, $red, $green, $blue, $text, $align) {
        $this->pdf->SetFont($font, '', $fontSize);
        $this->pdf->SetTextColor($red, $green, $blue);
        $this->pdf->SetXY($x,$y);
        $this->pdf->Cell(0,8,$text,0,0,$align);
    }

我多次调用此方法,例如:

$this->placeTextCell('crazy-font',8,5,30,255,255,255,'the text','R');
$this->placeTextCell('crazy-font',8,5,35,255,255,255,'the text','R');
$this->placeTextCell('crazy-font',8,5,40,255,255,255,'the text','R');
.... same with different 'y' coordinate

问题是,它几乎适用于所有细胞,有些细胞错位,例如:

             the text
             the text
        the text
    the text
             the text

我尝试调用 Ln(),但它没有做任何事情。 我真的不知道他们的时刻。有人知道为什么会这样吗?

【问题讨论】:

    标签: php pdf pdf-generation fpdf fpdi


    【解决方案1】:

    解决了,修剪做到了。有趣的是,之前所有的字符串都被修剪了,所以我想知道空格是从哪里来的......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-04
      • 2012-12-29
      • 2018-03-09
      • 2021-11-12
      • 1970-01-01
      • 1970-01-01
      • 2017-07-12
      • 1970-01-01
      相关资源
      最近更新 更多