首页 > 解决方案 > 如何使用 TCPDF 在 pdf 页面中显示图像?

问题描述

请找到以下代码。当我 print_r() 输出时,图像显示在网页中。但图像未显示在 PDF 页面中。谁能告诉我我的代码有什么问题?

$link = base_url();
    foreach($defect_photos as $defect_photo){
    $html1 .= "<td><img src='$link/uploads/defects/$defect_photo' border='0' height='500' width='500' align='right'></td>";
    }
    $html1 .= '</tr></table>';
    //print_r($html1);
    //exit;
    $pdf->writeHTML($html1, true, false, true, false, '');

提前致谢

标签: phpcodeignitertcpdf

解决方案


使用这行代码,您可以在 tcpdf 上添加图像。或详细信息,您可以访问https://tcpdf.org/examples/example_009/

$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false , 错误的);


推荐阅读