【发布时间】:2020-01-23 09:24:35
【问题描述】:
$message ='<img src="new_star.png" style="height:10px;width:10px">';
$pdf->writeHTML($message);
$pdf->Output();
如何使用此代码在 pdf 中显示图像
【问题讨论】:
$message ='<img src="new_star.png" style="height:10px;width:10px">';
$pdf->writeHTML($message);
$pdf->Output();
如何使用此代码在 pdf 中显示图像
【问题讨论】:
不要使用您发布的代码。而是使用 fPDF 提供的image 选项在文档中包含图像。除非图像位于运行脚本的目录中,否则请使用图像的完整路径。
文档中的原型是:
Image(string file [, float x [, float y [, float w [, float h [, string type [, mixed link]]]]]])
有关选项的详细信息,请参阅http://www.fpdf.org/ 提供的文档。
【讨论】:
这是使用fpdf在pdf中添加图像的方法
$pdf->Image('file link',x-position,y-position,width,height);
File link 是指向您的图像的链接,x & y position 是图像所在的位置。 width and height 是图像的宽度和高度。
您还可以查看 fpdf 文档。 Documentation for images
【讨论】: