Open up your Ubuntu terminal and create a new .sh file:
sudo nano wkhtmltopdf_install.sh
Now add the following code in it:
echo -e "\n---- Install WkHtmlToPdf 0.12.5 ----"
sudo apt-get install libxrender1
sudo apt install xvfb
sudo wget -P Downloads https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb
cd Downloads
sudo dpkg -i wkhtmltox_0.12.5-1.trusty_amd64.deb
cd /usr/local/bin
sudo cp wkhtmltoimage /usr/bin/wkhtmltoimage
sudo cp wkhtmltopdf /usr/bin/wkhtmltopdf
echo -e "Wkhtmltopdf is installed!"
The next step is to make the file executable:
sudo chmod +x wkhtmltopdf_install.sh
And finally, now it is executable, execute it.
./wkhtmltopdf_install.sh
in the file config / snappy.php the configuration must be configured in the following way.
return array(
'pdf' => array(
'enabled' => true,
'binary' => '/usr/bin/xvfb-run -- /usr/bin/wkhtmltopdf',
'timeout' => false,
'options' => array(),
'env' => array(),
),
'image' => array(
'enabled' => true,
'binary' => '/usr/bin/xvfb-run -- /usr/bin/wkhtmltoimage',
'timeout' => false,
'options' => array(),
'env' => array(),
),
);