You can check here for getting the latest version. Change the wget url to download newer versions.
$ sudo apt-get update && sudo apt-get -y install wkhtmltopdf
$ sudo apt-get install -y software-properties-common && \
sudo apt-add-repository -y "deb http://security.ubuntu.com/ubuntu bionic-security main" && \
sudo apt-get -yq update && \
sudo apt-get install -y libxrender1 libfontconfig1 libx11-dev libjpeg62 libxtst6 \
fontconfig xfonts-75dpi xfonts-base libpng12-0 && \
wget "https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb" && \
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb && \
sudo apt-get -f install
- libxrender1
Credits to danielghitoiu
$ sudo apt-get install libxrender1
$ 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
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
$ sudo mv wkhtmltoimage /usr/bin/wkhtmltoimage
$ sudo chmod a+x /usr/bin/wkhtmltopdf
$ sudo chmod a+x /usr/bin/wkhtmltoimage
Credits to @vmdao and @TurkerTunali
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.xenial_amd64.deb
$ sudo dpkg -i wkhtmltox_0.12.5-1.xenial_amd64.deb
$ sudo apt -f install
$ brew update && brew install wkhtmltopdf --cask
$ wkhtmltopdf https://google.com google.pdf
//Linux
$ xdg-open google.pdf
//MacOS
$ open google.pdf
// Clean up
$ rm google.pdf
Loading pages (1/6)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
Thank you for the information!
In my case
wkhtmltopdf 0.12.5 - Ubuntu 16.04 x64
i had to install these packages
apt-get install -y libpthread-stubs0-dev libxau-dev xorg-sgml-doctools libxdmcp-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev xtrans-dev libx11-dev libxcb1-dev libjpeg62 libxtst6 libfontenc1 libxfont1 x11-common xfonts-encodings xfonts-utils fontconfig xfonts-base xfonts-75dpi