wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools used to render HTML into PDF and various image formats using the Qt WebKit rendering engine. wkhtmltopdf is able to put several objects into the output file, an object is
either a single webpage, a cover webpage or a table of contents.

The objects are put into the output document in the order they are specified on the command line, options can be specified on a per object basis or in the global options area. In this blog post you’ll learn to install wkhtmltopdf & wkhtmltoimage on CentOS 8 | CentOS 7 Linux machine.

Install wkhtmltopdf & wkhtmltoimage on CentOS 8 | CentOS 7

The binary packages of wkhtmltopdf are provided for CentOS 8 and CentOS 7. These packages are available in the software downloads section.

Install wget which we’ll use to download wkhtmltopdf RPM package on CentOS 8 | CentOS 7:

sudo yum -y install wget

Install wkhtmltopdf on CentOS 8:

Download the software package with wget or curl.

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm

Install with rpm or yum package management tools.

sudo dnf localinstall wkhtmltox-0.12.6-1.centos8.x86_64.rpm

A number of dependencies are installed.

Dependencies resolved.
 Package                                        Architecture                  Version                                   Repository                           Size
 wkhtmltox                                      x86_64                        1:0.12.6-1.centos8                        @commandline                         15 M
Installing dependencies:
 dejavu-fonts-common                            noarch                        2.35-6.el8                                BaseOS                               74 k
 dejavu-sans-fonts                              noarch                        2.35-6.el8                                BaseOS                              1.5 M
 fontconfig                                     x86_64                        2.13.1-3.el8                              BaseOS                              275 k
 fontpackages-filesystem                        noarch                        1.44-22.el8                               BaseOS                               16 k
 libX11                                         x86_64                        1.6.8-3.el8                               AppStream                           611 k
 libX11-common                                  noarch                        1.6.8-3.el8                               AppStream                           158 k
 libXau                                         x86_64                        1.0.8-13.el8                              AppStream                            36 k
 libXext                                        x86_64                        1.3.3-9.el8                               AppStream                            45 k
 libXrender                                     x86_64                        0.9.10-7.el8                              AppStream                            33 k
 libfontenc                                     x86_64                        1.1.3-8.el8                               AppStream                            37 k
 libjpeg-turbo                                  x86_64                        1.5.3-10.el8                              AppStream                           156 k
 libpkgconf                                     x86_64                        1.4.2-1.el8                               BaseOS                               35 k
 libxcb                                         x86_64                        1.13.1-1.el8                              AppStream                           229 k
 pkgconf                                        x86_64                        1.4.2-1.el8                               BaseOS                               38 k
 pkgconf-m4                                     noarch                        1.4.2-1.el8                               BaseOS                               17 k
 pkgconf-pkg-config                             x86_64                        1.4.2-1.el8                               BaseOS                               15 k
 ttmkfdir                                       x86_64                        3.0.9-54.el8                              AppStream                            62 k
 xorg-x11-font-utils                            x86_64                        1:7.5-40.el8                              AppStream                           103 k
 xorg-x11-fonts-75dpi                           noarch                        7.5-19.el8                                AppStream                           2.8 M
 xorg-x11-fonts-Type1                           noarch                        7.5-19.el8                                AppStream                           522 k

Transaction Summary
Install  21 Packages

Total size: 22 M
Total download size: 6.6 M
Installed size: 139 M
Is this ok [y/N]: y

Install wkhtmltopdf on CentOS 7:

Download the RPM package of wkhtmltopdf:

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm

Then install wkhtmltopdf on CentOS 7 by executing the following commands:

sudo yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm

Confirm software versions installed.

$ wkhtmltopdf --version
wkhtmltopdf 0.12.6 (with patched qt)

$ wkhtmltoimage --version
wkhtmltoimage 0.12.6 (with patched qt)

Convert web page to pdf:

$  wkhtmltopdf <webpage> <destination-pdf-file>

More interesting articles available in our website.

Install and Configure Virtualmin on CentOS

Install and Configure Seafile Storage on CentOS

Install wtfutil Personal Information Dashboard for your terminal

Install Bashtop – Terminal Resource Monitor for Linux | macOS | FreeBSD

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here