Skip to content

Instantly share code, notes, and snippets.

@hrshadhin
Last active February 26, 2018 12:00
Show Gist options
  • Save hrshadhin/7f76332a32ea9eae56e3c0eb085b083c to your computer and use it in GitHub Desktop.
Save hrshadhin/7f76332a32ea9eae56e3c0eb085b083c to your computer and use it in GitHub Desktop.
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
mv wkhtmltox/bin/wkhtmlto* /usr/bin/
ln -nfs /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
sudo apt-get install xvfb
sudo apt-get install libxrender1
#file name "wkhtmltopdf.sh" and put below line in it.
xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf "$@"
Move this shell script to /usr/local/bin, and set permissions:
sudo mv wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf.sh
sudo chmod a+x /usr/local/bin/wkhtmltopdf.sh
#now test
/usr/local/bin/wkhtmltopdf.sh http://www.google.com test.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment