动态值在dompdf中的src属性
问题描述:
我正在为多家公司制作发票pdf。每家公司都有自己的标志,他们希望以PDF格式进行。为了生成PDF,我使用了dompdf。现在,当使用图像的相对路径对src属性的值进行硬编码时,它在pdf上呈现得非常好。例如,在笨:现在动态值<img>在dompdf中的src属性
$this->load->helper(array('dompdf', 'file'));
$html = '<img style = "height: 140px; width: 180px;" src = "images/logo.png" />';
pdf_create($html, 'filename');
$data = pdf_create($html, '', false);
,作为图像的相对路径不会改变,每次根据登录的,我想给SRC在客户端上属性的动态值像这样:
$this->load->helper(array('dompdf', 'file'));
$html = '<img style = "height: 140px; width: 180px;" src = '; $row->img; $html.=' />';
pdf_create($html, 'filename');
$data = pdf_create($html, '', false);
在哪里$ row-> img在某些情况下的值为images/logo.png(该值将根据登录的人而变化)。
使用上面的代码只是给了我一个pdf上的空白空间,甚至没有一个破碎的图像没有任何错误信息。请帮助我,因为它已经是我的一个美好的一天。
评论,建议,答复高度赞赏再次感谢。
答
试试这个:
$html = '<img style = "height: 140px; width: 180px;" src ="'.$row->img.'"/>';