Last active
December 14, 2022 13:44
-
-
Save itzikbenh/7af73a35039032f6ab89f3f7ffb83688 to your computer and use it in GitHub Desktop.
Install wkhtmltopdf in Ubuntu 16.04.1 so you can use Laravel Snappy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get package | |
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz | |
sudo apt install wkhtmltopdf | |
//create symlink. | |
sudo ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf | |
//At this point you can run this command to test that everything works. | |
/usr/local/bin/wkhtmltopdf google.com google.pdf | |
//Command above will give you the following error - QXcbConnection: Could not connect to display Aborted (core dumped) | |
//This is due to a bug in the debian packages, or something like that :) | |
//Solution taken from here - http://unix.stackexchange.com/questions/192642/wkhtmltopdf-qxcbconnection-could-not-connect-to-display | |
sudo apt install xvfb | |
//Now in the snappy config file change this | |
'binary' => '/usr/local/bin/wkhtmltopdf', | |
//To | |
'binary' => '/usr/bin/xvfb-run -- /usr/local/bin/wkhtmltopdf', | |
It should work now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you! You saved my Day