我正在将KNP Snappy 与 Symfony2 一起使用。当我使用来自控制器的响应时,我得到以下响应:
The exit status code '2' says something went wrong:
stderr: "Loading pages (1/6)
[> ] 0%
[======> ] 10%
[============================> ] 48%
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[===================> ] Page 1 of 3
[=======================================> ] Page 2 of 3
[============================================================] Page 3 of 3
Done
Exit with code 2 due to http error: 404 Page not found
"
stdout: ""
command: /usr/bin/wkhtmltopdf --lowquality --no-outline '/tmp/knp_snappy527f3354ad21d2.78976975.html' '/tmp/knp_snappy527f3354ad6e37.45993260.pdf'.
部分控制器如下所示:
$html = $this->renderView('MyBundle:Visit:print.html.twig', array(
'visit' => $visit,
'themes' => $themes
));
return new Response(
$this->get('knp_snappy.pdf')->getOutputFromHtml($html),
200,
array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="file.pdf"'
)
);
文件生成了,看起来不错。但响应高于错误。
有谁知道问题可能是什么?