Friday, November 1, 2024
Google search engine
HomeGuest BlogsInstall wkhtmltopdf & wkhtmltoimage on Rocky Linux|AlmaLinux 8

Install wkhtmltopdf & wkhtmltoimage on Rocky Linux|AlmaLinux 8

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.

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

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 on Rocky|AlmaLinux 8

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:

Last metadata expiration check: 0:17:24 ago on Tue 14 Dec 2021 06:18:33 PM UTC.
Dependencies resolved.
======================================================================================================================================================================================================
 Package                                                 Architecture                           Version                                            Repository                                    Size
======================================================================================================================================================================================================
Installing:
 wkhtmltox                                               x86_64                                 1:0.12.6-1.centos8                                 @commandline                                  15 M
Installing dependencies:
 dejavu-fonts-common                                     noarch                                 2.35-7.el8                                         baseos                                        73 k
 dejavu-sans-fonts                                       noarch                                 2.35-7.el8                                         baseos                                       1.5 M
 fontconfig                                              x86_64                                 2.13.1-4.el8                                       baseos                                       273 k
 fontpackages-filesystem                                 noarch                                 1.44-22.el8                                        baseos                                        15 k
 libX11                                                  x86_64                                 1.6.8-5.el8                                        appstream                                    610 k
 libX11-common                                           noarch                                 1.6.8-5.el8                                        appstream                                    157 k
 libXau                                                  x86_64                                 1.0.9-3.el8                                        appstream                                     36 k
 libXext                                                 x86_64                                 1.3.4-1.el8                                        appstream                                     44 k
 libXrender                                              x86_64                                 0.9.10-7.el8                                       appstream                                     32 k
 libfontenc                                              x86_64                                 1.1.3-8.el8                                        appstream                                     36 k
 libjpeg-turbo                                           x86_64                                 1.5.3-12.el8                                       appstream                                    156 k
 libxcb                                                  x86_64                                 1.13.1-1.el8                                       appstream                                    228 k
 ttmkfdir                                                x86_64                                 3.0.9-54.el8                                       appstream                                     61 k
 xorg-x11-font-utils                                     x86_64                                 1:7.5-41.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                                    521 k

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:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

RELATED ARTICLES

Most Popular

Recent Comments