FPDF带有图像的mc表

时间:2018-07-20 13:54:28

标签: php fpdf

我无法使用mc表FPDF显示图像(或这次是照片)。

这是我的一些脚本:

$pdf=new PDF_MC_Table();
$pdf->SetWidths(array(30,10,30,230));
$pdf->SetAligns(array('L','L','L','C'));
$pdf->Row(array($name, $age, $gender, $photo));
$pdf->Output();

$photo填充要在PDF表中显示的图像的位置。

图片根本不显示,而是显示该位置的文字

1 个答案:

答案 0 :(得分:0)

我已经知道答案了

在mc_table.php中,我添加了

...
function Row($data)
{
  ...
  for($i=0;$i<count($data);$i++)
  {
    ...
    if(substr($data[$i],-3) == 'jpg' || substr($data[$i],-3) == 'png')
    {
      $ih = $h - 0.5;
      $iw = $w - 0.5;
      $ix = $x + 0.25;
      $iy = $y + 0.25;
      //show image
      $this->MultiCell($w,5,$this->Image ($data[$i],$ix,$iy,$iw),0,$a);
    }else
    {
      //Print the text
      $this->MultiCell($w,5,$data[$i],0,$a);
    }
  ...
  }
}
相关问题