exceeded the timeout of 60 seconds knpSnappyBundle?
Bonsoir,
j'utilise maintenant le bundle "KnpSnappyBundle" pour exporter des documents en PDF. Donc, j'ai l'installé dans le dossier "vendor"
Voilà le code de mon action :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
public function STAction( $id)
{
$resultatDetaille = $em->getRepository('StatsBundle:Stat')->find($id);
$html = $this->renderView('StatsBundle:Stat:resultat.html.twig',
array('resultat' => $resultatDetaille,
));
$filename = sprintf('Stat-%s.pdf', date('d-m-Y'));
return new Response(
$this->get('knp_snappy.pdf')->getOutputFromHtml($html),
200,
[
'Content-Type' => 'application/pdf',
'Content-Disposition' => sprintf('attachment; filename="%s"', $filename),
]
);
} |
Pour l'accéder aux mes fichiers CSS, j'ai utilisé le principe de app.request comme ceci:
Code:
1 2
|
<link href="{{ app.request.scheme ~'://'~ app.request.server.get("HTTP_HOST") ~ asset('template/css/style.css') }}" rel="stylesheet"> |
Lors du test j'ai rencontré un probléme que j'arrive pas à résoudre pour éviter le probléme de timeout 60 seconde :
Citation:
The process "/home/syrine01/Desktop/SecurityInfo/app/../vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality '/tmp/knp_snappy57d4857eaf9609.98521831.html' '/tmp/knp_snappy57d4857eafc657.82703273.pdf'" exceeded the timeout of 60 seconds.
je trouve la solution pour le résoudre :(
Merci de m'aider,