php - 带图像的 FPDF mc 表
问题描述
我无法使用 mc table 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 表格中显示的图像的位置。
该图像根本不显示,而是显示该位置的文本
解决方案
我已经得到了答案
在 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);
}
...
}
}
推荐阅读
- python-3.x - EOFError:读取一行时出现EOF
- python - 使用 np.logical_and 后内核死机
- java - For循环正在打印出多个打印语句
- android - 如何将 Json 字符串填充到 Android 微调器中
- google-api - 用于组织的 Google 日历 API
- firebase - SwiftUI Firebase - 如何查询文档然后更新?
- sql - SQL Server 替换列值中的不同字符
- python - 插入数据库后,字符串 'ə' 成为 SQL Server 的问号
- webrtc - WebRTC:IceCandidates 不收集在 Chrome/Edge 中
- java - 使用另一个 maven 项目 (Java) 的依赖项构建新项目的简单方法