Use wkhtmltopdf on linux

759 Views Asked by At

I'm using wkhtmltopdf in my Symfony project and everything is working on my computer. But when I put my project on a CentOS server I'm no longer able to create pdf files.

I'm using this line, but on a linux server .exe files can't be executed:

$snappy = new Pdf($this->get('kernel')->getRootDir() . '/../web/wkhtmltopdf/bin/wkhtmltopdf.exe');

I tried to download the .rpm file for CentOS, but I still have the same errors.

1

There are 1 best solutions below

1
On BEST ANSWER

I solved it by installing wkhtmltopdf like it's explained in this link: http://www.kitpages.fr/fr/cms/182/installer-wkhtmltopdf-sous-centos-et-debian

And after that I can give the path of wkhtmltopdf in CentOS which is: /opt/wkhtmltopdf/bin/wkhtmltopdf

The line is now like this:

$snappy = new Pdf('/opt/wkhtmltopdf/bin/wkhtmltopdf');