我正在使用 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"'
)
);
生成文件,看起来很好。但是响应高于错误。
有人知道问题是什么吗?