【发布时间】:2014-02-28 12:29:59
【问题描述】:
我搜索过在 symfony 2.3 中创建 pdf 文件但没有成功。我有 2 束
我的任务只是点击下载 pdf 文件。为此,我在 html.twig 中给出了链接,例如
<a href="{{path('route name')}}">Download file</a>
在 pdf 操作中,我正在生成 PDF 文件
在我正在做的 knp snapy bundle 中:
$html = $this->renderView('MyBundle:Foo:bar.html.twig', array(
'some' => $vars
));
return new Response(
$this->get('knp_snappy.pdf')->getOutputFromHtml($html),
200,
array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="file.pdf"'
)
);
出现错误
退出状态代码“1”表示出了点问题:stderr:“The 系统找不到指定的路径。
如果是,wkpdftohtml 是否需要安装,那么我如何在基于共享的主机上安装。
在 psliwa / PHPdf 我已经阅读了以下示例:
得到了
找不到树枝文件
如果我将 $format = $this->get('request')->get('_format'); 更改为 $format='pdf';,那么它会显示简单的 html 文件。
无法理解我应该怎么做才能完成任务...
【问题讨论】:
标签: php symfony pdf wkhtmltopdf symfony-2.3