KnpSnappyBundle - stderr: "wkhtmltopdf: cannot connect to X server" stdout: ""

Ich versuche, die KnpSnappyBundle zum erstellen von PDF-Dateien von twig-templates.

Ich habe folgte diesem post zu installieren wkhtmltopdf und es funktioniert, wenn ich tun:

wkhtmltopdf http://www.google.com test.pdf

aber wenn ich versuche eine PDF-Datei erstellen aus einer controller:

$this->get('knp_snappy.pdf')->generateFromHtml(
$this->renderView('AcmePDFBundle:Default:template.html.twig'),
'../app/var/PDFfiles/PDF.pdf'
); 

Ich bin immer diese Fehlermeldung:

request.CRITICAL: RuntimeException: The exit status code '1' says something went wrong:
stderr: "wkhtmltopdf: cannot connect to X server
"
stdout: ""
command: /usr/bin/wkhtmltopdf --lowquality '/tmp/knp_snappy532ca2272fba44.73835084.html' '../app/var/files/PDF.pdf'. (uncaught exception) at /home/me/MyServer/project/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php line 304 [] []

Irgendeine Idee wie es zu lösen?

Dies ist meine Konfiguration für KnpSnappyBundle:

knp_snappy:
    pdf:
        enabled:    true
        binary:     /usr/bin/wkhtmltopdf
        options:    []
    image:
        enabled:    false
        binary:     /usr/bin/wkhtmltoimage
        options:    []
InformationsquelleAutor Manolo | 2014-03-22
Schreibe einen Kommentar