【问题标题】:Change text color in FPDF for text within cell更改 FPDF 中单元格内文本的文本颜色
【发布时间】:2014-06-16 13:52:51
【问题描述】:

我想在下面的代码中仅更改文本“HACCP Bulker Check”的文本颜色:

$pdf->SetTextColor(255,0,0);
$pdf->MultiCell($cell_width * 2, $cell_height, "HACCP Bulker Check\nPre-loading foreign object free", 'TLR', 1);
$pdf->SetTextColor(0,0,0);

有没有办法做到这一点?其余的文字需要是黑色的。

【问题讨论】:

    标签: php pdf text colors fpdf


    【解决方案1】:

    分割文本怎么样?

    $pdf->SetTextColor(255,0,0);
    $pdf->MultiCell($cell_width * 2, $cell_height, "HACCP Bulker Check", 'TLR', 1);
    $pdf->Ln();
    $pdf->SetTextColor(0,0,0);
    $pdf->MultiCell($cell_width * 2, $cell_heigt, "Pre-loading foreign object free", 'LR', 1);
    

    您可能需要调整单元格宽度。注意第二个单元格的更改边框值。

    【讨论】:

      猜你喜欢
      • 2012-12-29
      • 2013-03-23
      • 2016-02-21
      • 1970-01-01
      • 2013-10-18
      • 1970-01-01
      • 2014-06-18
      • 2011-04-11
      • 1970-01-01
      相关资源
      最近更新 更多