Categories

How to make WKHTMLTOPDF working on Linux?

If you are using Linux, you will probably have problems with the WKHTMLTOPDF library. There is a simple solution to make it work.

Firstly, please check the GrandNode, maybe the library works out of the box. Navigate to admin panel -> catalog -> products and try to generate the Products catalog in PDF. If you receive the PDF, that's fine, if not, let's jump into the next step.

In the command line, navigate to the application folder /Rotativa/Linux. Here you will find the binary of the WKHTMLTOPDF library. 

You need to download the proper version for your operating system https://wkhtmltopdf.org/downloads.html

Please use the wget command. 

In the case of Ubuntu 18.04, we used the following command:

sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb 

Extract it in the current directory with:

sudo ar x wkhtmltox_0.12.6-1.bionic_amd64.deb

Extract the data.tar.xz archive, where you will find the correct binary of the library.

sudo tar --xz -xf data.tar.xz

Navigate to bin folder with:

cd usr/local/bin

and copy the wkhtmltopdf file into the /Rotativa/Linux directory. 

Please remember to give proper permissions to that file. It can be chmod 755 /Rotativa/Linux

 

back to top