Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing wkhtmltopdf 0.12.4, 0.12.5 - Ubuntu 16.04 x64, 0.12.5 - Ubuntu 18.04 x64 - 0.12.5 - macOS Catalina 10.15

You can check here for getting the latest version. Change the wget url to download newer versions.

Install instructions
wkhtmltopdf 0.12.4 - Ubuntu 16.04 x64
wkhtmltopdf 0.12.5 - Ubuntu 16.04 x64
wkhtmltopdf 0.12.5 - Ubuntu 18.04 x64
wkhtmltopdf 0.12.5 - macOS Mojave 10.14 & Catalina 10.15
Install verification

wkhtmltopdf 0.12.4 - Ubuntu 16.04 x64

Prerequisites

  • 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

wkhtmltopdf 0.12.5 - Ubuntu 16.04 x64

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

wkhtmltopdf 0.12.5 - Ubuntu 18.04 x64

Credits to @J5Dev and @bcalik

$ 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

wkhtmltopdf 0.12.5 - macOS Mojave 10.14 / Catalina 10.15

Prerequisites

$ brew update && brew cask install wkhtmltopdf

Verify that it is working

$ wkhtmltopdf https://google.com google.pdf

//Linux
$ xdg-open google.pdf

//MacOS
$ open google.pdf

Output

Loading pages (1/6)
Counting pages (2/6)                                               
Resolving links (4/6)                                                       
Loading headers and footers (5/6)                                           
Printing pages (6/6)
Done    
@marlosirapuan

This comment has been minimized.

Copy link

@marlosirapuan marlosirapuan commented Jan 31, 2018

Thank you! Works very well! 👏

@festusngor

This comment has been minimized.

Copy link

@festusngor festusngor commented Apr 19, 2018

Works very well! Many thanks

@inwdragon

This comment has been minimized.

Copy link

@inwdragon inwdragon commented May 10, 2018

Thank you man! 👍

@mariusghitoiu

This comment has been minimized.

Copy link

@mariusghitoiu mariusghitoiu commented May 19, 2018

Thank you!

It looks like it requires to install libxrender1 as well

sudo apt-get install libxrender1

@airblade

This comment has been minimized.

Copy link

@airblade airblade commented May 21, 2018

I also needed sudo apt-get install libfontconfig1.

@frywer

This comment has been minimized.

Copy link

@frywer frywer commented Jun 20, 2018

Thank you! Works great!!

@nam-co

This comment has been minimized.

Copy link

@nam-co nam-co commented Jun 26, 2018

Thanks, do you have any idea on how to install 0.12.5 on ubuntu 18? appreciate any help

@vmdao

This comment has been minimized.

Copy link

@vmdao vmdao commented Jul 8, 2018

Thank you so muck!

@nam-co
You can check here for getting the latest version.
Change the wget url to download newer versions.
Version 0.12.5

$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_i386.deb
$ dpkg -i  wkhtmltox_0.12.5-1.trusty_i386.deb
$ apt -f install

Check

$wkhtmltopdf --version

if have err same version libstdc++.so.6. maybe OS not install right version
You check version here libstdc or link official

GCC 4.9.0: libstdc++.so.6.0.20
GCC 5.1.0: libstdc++.so.6.0.21
GCC 6.1.0: libstdc++.so.6.0.22
GCC 7.1.0: libstdc++.so.6.0.23
GCC 7.2.0: libstdc++.so.6.0.24
GCC 8.0.0: libstdc++.so.6.0.25

And install right version

$sudo apt-get install software-properties-common 
$sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$sudo apt-get update
$sudo apt-get install gcc-5 g++-5 // with me version 5
@J5Dev

This comment has been minimized.

Copy link

@J5Dev J5Dev commented Aug 4, 2018

For anyone else finding this and still having issues with this on Ubuntu 18.04 LTS, (I was due to getting the dependencies in), basically libpng12-0 is no longer referenced as standard in 18.04, so you need to add an additional repository to pull it from

The below should sort it for you.

sudo apt-get install -y software-properties-common && \
sudo apt-add-repository -y "deb http://security.ubuntu.com/ubuntu xenial-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.xenial_amd64.deb" && \
sudo dpkg -i wkhtmltox_0.12.5-1.xenial_amd64.deb && \
sudo apt-get -f install
@vizcubeinfotech

This comment has been minimized.

Copy link

@vizcubeinfotech vizcubeinfotech commented Feb 6, 2019

For me, it was not working 0.12.5.1 version with 18.04 but 0.12.4 worked. Thanks

@bcalik

This comment has been minimized.

Copy link

@bcalik bcalik commented Mar 11, 2019

Ubuntu 18 steps should use bionic package, not xenial one.
This is the bionic package url: https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

@Client-Z

This comment has been minimized.

Copy link

@Client-Z Client-Z commented Mar 29, 2019

Thank you

@TurkerTunali

This comment has been minimized.

Copy link

@TurkerTunali TurkerTunali commented Jun 20, 2019

For the "wkhtmltopdf 0.12.5 - Ubuntu 16.04 x64" part, it downloads wrong package.
It should download xenial but downloads trusty.

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

@paablux

This comment has been minimized.

Copy link

@paablux paablux commented Jun 25, 2019

Thanks!!

@lijoantony

This comment has been minimized.

Copy link

@lijoantony lijoantony commented Sep 10, 2019

For "wkhtmltopdf 0.12.5 - Ubuntu 18.04 x64", I got this error
E: Package 'libpng12-0' has no installation candidate
Dropping 'libpng12-0' from the list worked.

@joaomcarlos

This comment has been minimized.

Copy link

@joaomcarlos joaomcarlos commented Sep 24, 2019

Summary of the above comments for installing in Ubuntu 18.04:

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
@omocinteractive

This comment has been minimized.

Copy link

@omocinteractive omocinteractive commented Jan 2, 2020

... for Ubuntu 16.04 add:
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin

@blogui91

This comment has been minimized.

Copy link

@blogui91 blogui91 commented Jan 3, 2020

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

@NavalKishor

This comment has been minimized.

Copy link

@NavalKishor NavalKishor commented Jan 16, 2020

brew update && brew cask install wkhtmltopdf

Already up-to-date.

==> Caveats
Cask wkhtmltopdf installs files under /usr/local. The presence of such
files can cause warnings when running brew doctor, which is considered
to be a bug in Homebrew Cask.

==> Downloading https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1

curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
Error: Download failed on Cask 'wkhtmltopdf' with message: Download failed: https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.macos-cocoa.pkg

@peterlitvak

This comment has been minimized.

Copy link

@peterlitvak peterlitvak commented Apr 1, 2020

After latest mac os update it would not install with the following error:
Cask 'wkhtmltopdf' is unavailable: No Cask with this name exists

@devenpateldp

This comment has been minimized.

Copy link

@devenpateldp devenpateldp commented Apr 17, 2020

Thank you! Works very well! clap

@SodomousPrime

This comment has been minimized.

Copy link

@SodomousPrime SodomousPrime commented Apr 23, 2020

Ubuntu 19.10 -
Package libpng12-0 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libpng12-0' has no installation candidate

You have to exclude "libpng12-0" from the list to get past this first error, then it will fail on missing wkhtmltox requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.