How to install wkhtmltopdf on centos 8

How To Install wkhtmltopdf and wkhtmltoimage On CentOS 8

On this article, we will discuss how to install wkhtmltopdf and wkhtmltoimage version 0.12.6.0 On Linux CentOS 8 operating system.

Introduction

wkhtmltopdf and wkhtmltoimage is an open source (LGPLv3) and much effective command-line shell utility that enables user to convert any given HTML (Web Page) to PDF document or an image (jpg, png, etc). On this article we will discuss how to install

wkhtmltopdfn and whtmltoimage installation

The last stable of wkhtmltopdf and whktmltoimage is version 0.12.6, which was released on June 11, 2020. We will use its distribution for our tutorial purpose. The installation process will be consist of several simple steps as described below :

  1. Download binnary files from official wkhtmlmtopdf github
  2. Install source and verify its version
  3. Test the software tools

Download wkhtmltopdf binnary files

The first step on this tutorial is to download the wkhtmltopdf sourc file from official wkhtmlmtopdf github, by using wget command line : wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm.

[ramans@localhost ~]$ wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm
 --2020-12-29 18:14:04--  https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm
 Resolving github.com (github.com)… 52.74.223.119
 Connecting to github.com (github.com)|52.74.223.119|:443… connected.
 HTTP request sent, awaiting response… 302 Found
 Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/131323182/4c2dd800-ab8e-11ea-95aa-09875726406d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201230%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201230T021405Z&X-Amz-Expires=300&X-Amz-Signature=26d83e365e1c9b92a37a961a170750408fa4f4a045957219cac4ff689f195b60&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=131323182&response-content-disposition=attachment%3B%20filename%3Dwkhtmltox-0.12.6-1.centos8.x86_64.rpm&response-content-type=application%2Foctet-stream [following]
 --2020-12-29 18:14:06--  https://github-production-release-asset-2e65be.s3.amazonaws.com/131323182/4c2dd800-ab8e-11ea-95aa-09875726406d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201230%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201230T021405Z&X-Amz-Expires=300&X-Amz-Signature=26d83e365e1c9b92a37a961a170750408fa4f4a045957219cac4ff689f195b60&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=131323182&response-content-disposition=attachment%3B%20filename%3Dwkhtmltox-0.12.6-1.centos8.x86_64.rpm&response-content-type=application%2Foctet-stream
 Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)… 52.217.4.76
 Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.4.76|:443… connected.
 HTTP request sent, awaiting response… 200 OK
 Length: 16237416 (15M) [application/octet-stream]
 Saving to: ‘wkhtmltox-0.12.6-1.centos8.x86_64.rpm’
 wkhtmltox-0.12.6-1.centos8. 100%[=========================================>]  15.48M   231KB/s    in 2m 52s  
 2020-12-29 18:17:01 (92.3 KB/s) - ‘wkhtmltox-0.12.6-1.centos8.x86_64.rpm’ saved [16237416/16237416]
download wkhtmltopdf
Download wkhtmltopdf

The wkhtmltox-0.12.6-1.centos8.x86_64.rpm file has been downloaded to our home directory.

Install wkhtmltopdf source and verify its version

The next step is to install the source file by using command line : sudo dnf localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm.

[ramans@localhost ~]$ sudo dnf localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm
 [sudo] password for ramans: 
 Last metadata expiration check: 0:10:16 ago on Tue 29 Dec 2020 06:16:56 PM PST.
 Dependencies resolved.
  Package                Architecture        Version                           Repository                 Size
 Downgrading:
  wkhtmltox              x86_64              1:0.12.6-1.centos7                @commandline               13 M
 Transaction Summary
 Downgrade  1 Package
 Total size: 13 M
 Is this ok [y/N]: y
 Downloading Packages:
 Running transaction check
 Transaction check succeeded.
 Running transaction test
 Transaction test succeeded.
 Running transaction
   Preparing        :                                                                                      1/1 
   Downgrading      : wkhtmltox-1:0.12.6-1.centos7.x86_64                                                  1/2 
   Cleanup          : wkhtmltox-1:0.12.6-1.centos8.x86_64                                                  2/2 
   Running scriptlet: wkhtmltox-1:0.12.6-1.centos8.x86_64                                                  2/2 
   Verifying        : wkhtmltox-1:0.12.6-1.centos7.x86_64                                                  1/2 
   Verifying        : wkhtmltox-1:0.12.6-1.centos8.x86_64                                                  2/2 
 Installed products updated.
 Downgraded:
   wkhtmltox-1:0.12.6-1.centos7.x86_64                                                                         
 Complete!
install wkhtmltox on centos 8
installation of wkhtmltox on Centos 8

The wkhtmltox, where wkhtmltopdf and wkhtmltoimage exist has been competed done, the next step is to verify its verstion by querying it using command line : wkhtmltopdf -- version and wkhtmltoimage --version.

[ramans@localhost ~]$ wkhtmltopdf --version
 wkhtmltopdf 0.12.6 (with patched qt)
[ramans@localhost ~]$ wkhtmltoimage --version
 wkhtmltoimage 0.12.6 (with patched qt)
whktmltopdf and wkhtmltoimage version
whktmltopdf and wkhtmltoimage version

Test Using wkhtmltopdf and wkhtmltoimage

On this secation we will take a testing to generate an pdf and image file uwing wkhtmltopdf and wkhtmltoimage tools.

  • working directory : /home/ramans
  • web site to be printed : https://otodiginet.com/software/how-to-install-apache-activemq-on-centos-8/
  • pdf file to be produced : install_apache_active_MQ_on_CentOS8.pdf
  • image file to be produced : install_apache_active_MQ_on_CentOS8.jpeg
[ramans@localhost ~]$ wkhtmltopdf https://otodiginet.com/software/how-to-install-apache-activemq-on-centos-8 install_apache_active_MQ_on_CentOS8.pdf
 Loading pages (1/6)
 Counting pages (2/6)                                               
 Resolving links (4/6)                                                       
 Loading headers and footers (5/6)                                           
 Printing pages (6/6)
 Done   
[ramans@localhost ~]$ wkhtmltoimage https://otodiginet.com/database/tools-database/how-to-install-oracle-sql-developer-on-ubuntu-18-04 install_oracle_developer_on_ubuntu.jpeg
 Loading page (1/2)
 Rendering (2/2)                                                    
 Done                                                             

The file was created are :

[ramans@localhost ~]$ ls -ltr active_MQ
 -rw-rw-r--. 1 ramans ramans  753525 Dec 31 16:22 install_apache_active_MQ_on_CentOS8.pdf
 -rw-rw-r--. 1 ramans ramans 1852639 Dec 31 16:26 install_apache_active_MQ_on_CentOS8.jpeg
pdf and jpege files prouced by wkhtmltopdf and wkhtmltoiage
pdf and jpeg files prouced by wkhtmltopdf and wkhtmltoiage
wkhtmltopdf, pdf file

Conclusion

The wkhtmltopdf and wkhtmltoimage are useful tools for producing pdf and image file. On this article, we have through the installation it properly. I hope it will be useful for you. Stay at home, stay safe and happy weekend.

Share this article via :

One thought on “How To Install wkhtmltopdf and wkhtmltoimage On CentOS 8

Leave a Reply

Your email address will not be published. Required fields are marked *