Reputation: 308
I'm trying to generate an invoice pdf, so I'm using KnpSnappyBundle over symfony2 & twig to generate a pdf from html
On my ubuntu everything is working fine, in the production environment (FreeBSD, shared hosting) I get an error that I don't understand. my config
knp_snappy:
pdf:
enabled: true
binary: "%kernel.root_dir%/../bin/wkhtmltopdf-i386"
options:
lowquality: false
encoding: UTF-8
image:
enabled: false
binary: "%kernel.root_dir%/../bin/wkhtmltoimage-i386"
options: []
temporary_folder: %kernel.cache_dir%/snappy
the error
[2016-02-07 01:07:05] snappy.DEBUG: Generate from HTML (<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>MeVisa Invoice</ti) to file (/home/visallc/visallc.nichost.ru/src/MeVisa/ERPBundle/Controller/../../../../web/invoices/mevisa-invoice-3975-1.pdf). [] []
[2016-02-07 01:07:05] request.CRITICAL: Uncaught PHP Exception RuntimeException: "The exit status code '2' says something went wrong: stderr: "/home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386: 1: Syntax error: "(" unexpected " stdout: "" command: /home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386 --encoding 'UTF-8' '/home/visallc/visallc.nichost.ru/app/cache/prod/snappy/knp_snappy56b66e89618f48.25746598.html' '/home/visallc/visallc.nichost.ru/src/MeVisa/ERPBundle/Controller/../../../../web/invoices/mevisa-invoice-3975-1.pdf'." at /home/visallc/visallc.nichost.ru/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php line 336 {"exception":"[object] (RuntimeException(code: 0): The exit status code '2' says something went wrong:\nstderr: \"/home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386: 1: Syntax error: \"(\" unexpected\n\"\nstdout: \"\"\ncommand: /home/visallc/visallc.nichost.ru/app/../bin/wkhtmltopdf-i386 --encoding 'UTF-8' '/home/visallc/visallc.nichost.ru/app/cache/prod/snappy/knp_snappy56b66e89618f48.25746598.html' '/home/visallc/visallc.nichost.ru/src/MeVisa/ERPBundle/Controller/../../../../web/invoices/mevisa-invoice-3975-1.pdf'. at /home/visallc/visallc.nichost.ru/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php:336)"} []
I've reduced the html to "Hello PDF" and I've tried different packages and different config. But they're all based on wkhtmltopdf. Any help would be appreciated here, the point is to generate a PDF from html. Thank you stackoverflowers
Upvotes: 2
Views: 1011
Reputation: 13167
Try to upgrade your binary by downloading the latest version according to your platform.
http://wkhtmltopdf.org/downloads.html
Upvotes: 1