Install wkhtmltopdf & wkhtmltoimage on Rocky Linux|AlmaLinux 8

0
6186

In this article we shall perform the installation of wkhtmltopdf & wkhtmltoimage on Rocky Linux 8 |AlmaLinux 8 operating system. The wkhtmltopdf and wkhtmltoimage are command line tools created to help with rendering of HTML into PDF and various image formats using the QT Webkit rendering engine. They are open source and can be installed, and used freely on any Linux distribution. If you have an application that needs to convert web pages to PDF or image files, then these tools are right for your use case.

wkhtmltopdf & wkhtmltoimage run entirely “headless” and there is no requirement for a display or display service. This makes them ideal for use on Cloud server instances. These tools have RPM packages provided for RHEL based systems. We’ll download the rpm package manually and install it on our system.

Step 1: Download wkhtmltopdf & wkhtmltoimage tools

We’ll use wget tool for downloading. If not present, run the commands below to install it.

sudo yum -y install wget

Download the latest rpm release of the package:

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

Confirm the download is succesful.

$ du -sh wkhtmltox-0.12.6-1.centos8.x86_64.rpm
16M	wkhtmltox-0.12.6-1.centos8.x86_64.rpm

Step 2: Install wkhtmltopdf & wkhtmltoimage

Once the RPM file is available locally, we can install it using rpm or yum command:

sudo dnf install ./wkhtmltox-0.12.6-1.centos8.x86_64.rpm

Accept installation of the package by hitting on the y key:

...
Transaction Summary
======================================================================================================================================================================================================
Install  17 Packages

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

After installation the command line tools are available for your use:

$ wkhtmltopdf --help
$ wkhtmltoimage --help

Checking software versions can be done with the following command:

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

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

We can confirm wkhtmltopdf & wkhtmltoimage tools have been installed successfully on Rocky Linux 8 |AlmaLinux 8 system. Visit the Project documentation pages to learn more.

More guides on Rocky / AlmaLinux 8:

LEAVE A REPLY

Please enter your comment!
Please enter your name here