How To Install wkhtmltopdf and wkhtmltoimage on Ubuntu 19.04 / Debian 10

Windows Articles

How to Install APK file on Android

Hello Friends! Today we bring you a simple guide on how to install an APK file in Android. What...

How to Install the Latest version of FFmpeg on Ubuntu 20.04 / Debian 10?

Knowing how to install the latest version of FFmpeg is important if you know how to work with multimedia files. So in...

How to block emails from specific senders in Outlook

Hello, how are you? Today we will talk a little about Microsoft Outlook. It is well known that its main function is...

How to Block a phone number on Android

Hello friends. In this post, we will show you how to block a phone number on Android. Have you ever wondered how...

How to install Java 15 on CentOS 8 / CentOS 7

Recently Java 15 has been released with interesting new features in the accounting field and introducing many security patches. In spite of...

Today we are going to learn that how we can convert our web pages from html format to pdf or image format. For obtaining these results we’ll use the most famous command line tools wkhtmltopdf & wkhtmltoimage. They are Open Source Command line tools used for conversion processes from html to pdf and image respectively.
They both use the QT WebKit rendering engine to perform the actions.
By default, the versions available on Ubuntu are old for these tools. So, we have to Install them manually. Follow the guide to get started that how we can Install wkhtmltopdf & wkhtmltoimage on Ubuntu 19.04 Linux.
First of all we’ll download the tools from .deb package. Further these tools do not require a display so they are entirely headless.

Install wkhtmltopdf on Ubuntu 19.04 / Debian 10

Visit the below link to Download the latest precompiled binary from the release page.

Download latest version of wkhtmltopdf

Step 1: Install wkhtmltopdf on Ubuntu 19.04

sudo apt update
sudo apt -y install wget
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt -f install

If you get error for the fonts try the following command

sudo apt-get update -y
sudo apt-get install -y xfonts-75dpi

You can see the following results upon successful Installation.

(Reading database … 172496 files and directories currently installed.)
Preparing to unpack wkhtmltox_0.12.5-1.bionic_amd64.deb …
Unpacking wkhtmltox (1:0.12.5-1.bionic) over (1:0.12.5-1.bionic) …
Setting up wkhtmltox (1:0.12.5-1.bionic) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …

Step 2: Install wkhtmltopdf on Debian 10 / Debian 9

To Install on Debian 9 type the following command

sudo apt update
sudo apt -y install wget
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb
sudo apt -f install

Make sure to check the Installed version to verify your Installation.

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


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

Step 3: How to Use wkhtmltopdf on Ubuntu / Debian

Run the given command to convert a web page to PDF format.

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

Look at the example:

wkhtmltopdf https://osradar.com osradar.pdf

Execution Output:

As you can see the results, a pdf file is being created and you can now view the contents.

$ file osradar.pdf

You can convert to image using the same syntax as:

$  wkhtmltoimage  https://osradar.com osradar.png

Congratulations! You’ve learned how we can convert our web pages to pdf and Image format using wkhtmltopdf & wkhtmltoimage tool.
If you’ve any queries regarding this tutorial, feel free to ask!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to Install APK file on Android

Hello Friends! Today we bring you a simple guide on how to install an APK file in Android. What...

How to Install the Latest version of FFmpeg on Ubuntu 20.04 / Debian 10?

Knowing how to install the latest version of FFmpeg is important if you know how to work with multimedia files. So in...

How to block emails from specific senders in Outlook

Hello, how are you? Today we will talk a little about Microsoft Outlook. It is well known that its main function is...

How to Block a phone number on Android

Hello friends. In this post, we will show you how to block a phone number on Android. Have you ever wondered how...

How to install Java 15 on CentOS 8 / CentOS 7

Recently Java 15 has been released with interesting new features in the accounting field and introducing many security patches. In spite of...
x