【发布时间】:2015-03-20 17:59:08
【问题描述】:
我在控制器中使用:
$html = $this->renderView('RaportBundle:pdf:magazinesbarcode.html.twig', array(
'magazines' => $magazines
));
return new Response(
$this->get('knp_snappy.pdf')->getOutputFromHtml($html,
array('images'=> true,'enable-external-links' => true)
),
200,
array(
'images' =>true,
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="file.pdf"'
)
);
普通文档示例。 HTML 生成良好,使用我的绝对 img 路径
<img src="{{ asset('uploads/barcode/2.jpg', absolute=true) }}" />
但在 pdf 中没有显示图像。 如果我保存生成的 html 并使用 wkhtmltopdf 从控制台图像中的这个文件保存在 pdf 中。 所以问题出在 Snappy budle 中。 视窗 8.1 x64。 怎么了?
【问题讨论】:
标签: symfony wkhtmltopdf