Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darwintnt/e0b4766d12ec15734708ec48a5d61bc5 to your computer and use it in GitHub Desktop.
Save darwintnt/e0b4766d12ec15734708ec48a5d61bc5 to your computer and use it in GitHub Desktop.
Installation of wkhtmltopdf v0.12.5 for Laravel-Snappy Ubuntu 16.04

Installation of wkhtmltopdf v0.12.5 for Laravel-Snappy Ubuntu 16.04

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(),
    ),


);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment