Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save srmds/2507aa3bcdb464085413c650fe42e31d to your computer and use it in GitHub Desktop.
Save srmds/2507aa3bcdb464085413c650fe42e31d to your computer and use it in GitHub Desktop.
Installing wkhtmltopdf 0.12.4, 0.12.5 0.12.6 - Ubuntu 22.04 - 0.12.6, 16.04 x64, 0.12.5 - Ubuntu 18.04 x64 - 0.12.5 - macOS Ventura -13.6

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

Install instructions
wkhtmltopdf 0.12.6 - Ubuntu 22.04 x64
wkhtmltopdf 0.12.5 - Ubuntu 18.04 x64
wkhtmltopdf 0.12.4 - Ubuntu 16.04 x64
wkhtmltopdf 0.12.5 - Ubuntu 16.04 x64
wkhtmltopdf 0.12.6 - macOS Ventura 13.6
Install verification

wkhtmltopdf 0.12.6 - Ubuntu 22.04 x64

$ sudo apt-get update && sudo apt-get -y install wkhtmltopdf

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.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.6 - macOS Ventura 13.6

Prerequisites

$ brew update && brew install wkhtmltopdf --cask

Verify that it is working

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

//Linux
$ xdg-open google.pdf

//MacOS
$ open google.pdf

// Clean up
$ rm 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    
@omocinteractive
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@devenpateldp
Copy link

Thank you! Works very well! clap

@SodomousPrime
Copy link

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.

@ikunyemingor
Copy link

Error on Ubuntu 18.04
--2020-11-05 15:57:04-- https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
Resolving downloads.wkhtmltopdf.org (downloads.wkhtmltopdf.org)... failed: Name or service not known.
wget: unable to resolve host address ‘downloads.wkhtmltopdf.org’

@ludoComp9
Copy link

Installation proposed for Ubuntu 20.04 LTS:
sudo apt-get install -y software-properties-common &&
sudo apt-add-repository -y "deb http://security.ubuntu.com/ubuntu focal-security main" &&
sudo apt-get -yq update &&
sudo apt-get install -y libxrender1 libfontconfig1 libx11-dev libjpeg62 libxtst6
fontconfig xfonts-75dpi xfonts-base &&
wget "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb" &&
sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb &&
sudo apt-get -f install

--> libpng12.0 removed as it is no more supported by ubuntu
--> use wkhtmltopdf 0.12.6-1 (more recent)

@dimaBlitz
Copy link

Worked from the first try for Ubuntu 22.04
Thank you very much !

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