我尝试使用KnpsnappyBundle从树枝视图生成pdf,它开始加载,直到“超过360秒的最大执行时间”,问题是我可以在生成的temp文件夹中找到pdf文件,但是需要在浏览器中为用户下载。
try {
$html = $this->renderView('ordreexecute.html.twig',['demande' => $demande,'username'=>$username]);
$filename = 'myFirstsnappypDF';
return new Response(
$this->knpsnappy->getOutputFromHtml($html),200,array(
'Content-Type' => 'application/pdf','Content-Disposition' => 'attachement; filename="' . $filename . '.pdf"'
)
);
}
catch(\Exception $e){
error_log($e->getMessage());
}