How to Install wkhtmltopdf & wkhtmltoimage on Ubuntu Linux

Richard
Written by
Richard
Mar 27, 2020 Updated Mar 18, 2026 3 min read
How to Display Seconds on Ubuntu Top Menu Clock

You can install wkhtmltopdf and wkhtmltoimage on Ubuntu Linux using the command line.

These are powerful command-line utilities that convert HTML into PDF documents and various image formats by leveraging the Qt WebKit rendering engine. They operate “headless,” meaning they don’t need a graphical interface to function.

Many web applications use wkhtmltopdf and wkhtmltoimage for automated report generation and content rendering. This guide focuses on installing them on Ubuntu versions 18.04 and 16.04.

Install wkhtmltopdf & wkhtmltoimage

Install wkhtmltopdf and wkhtmltoimage in Ubuntu is as simple as running the apt command. However, the version that comes with Ubuntu might not necessarily be the latest.

You’ll want to download the .deb file from the project website to install the latest.

At the time of this writing, the current stable series is 0.12.5, which was released on June 11, 2018.

Check the link below for the latest version as it becomes available:

First, installed the required packages if you don’t already have them:

🐧Bash / Shell
sudo apt update 
sudo apt install wget xfonts-75dpi

Then run the commands below to download and install.

Command Prompt
cd /tmp
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

If you run into trouble installing, simply follow the commands above:

🐧Bash / Shell
sudo apt -f install

After installing, you can verify that they’re installed by running the commands below:

💻Code
wkhtmltopdf --version

That should output a similar line as shown below:

💻Code
wkhtmltopdf 0.12.5 (with patched qt)

Run the following command below:

💻Code
wkhtmltoimage --version

Will output a similar line as shown below

💻Code
wkhtmltoimage 0.12.5 (with patched qt)

Use wkhtmltopdf & wkhtmltoimage

wkhtmltopdf can put several objects into the output file; an object is either a single webpage, a cover webpage, or a table of contents.

The syntax below is how to use wkhtmltopdf.

💻Code
wkhtmltopdf  source_file    destination_file.pdf

For example, if you’d like to the example.com webpage into PDF, simply run the commands below.

💻Code
wkhtmltopdf https://example.com    example.com.pdf

The web content will be generated into a PDF file.

For more about how to use the command, read this page:

This’s it!

Conclusion:

This post showed you how to install wkhtmltopdf and wkhtmltoimage on Ubuntu 18.04 | 16.04. If you find any error, please report it in the comment form below.

Thanks,

You may also like the post below:

Frequently Asked Questions

What is wkhtmltopdf and wkhtmltoimage?

wkhtmltopdf and wkhtmltoimage are command line tools used to convert HTML documents into PDF and image formats, respectively. They utilize the Qt WebKit rendering engine to produce high-quality outputs.

How do I install wkhtmltopdf on Ubuntu?

To install wkhtmltopdf on Ubuntu, you need to download the .deb file from the official website and use the `dpkg` command to install it. Make sure to first install required packages using `sudo apt install wget xfonts-75dpi`.

Can I use wkhtmltopdf without a graphical interface?

Yes, wkhtmltopdf and wkhtmltoimage are designed to run in a headless mode, meaning they do not require a graphical user interface. This makes them suitable for server environments and automated tasks.

What command do I use to convert a webpage to PDF?

To convert a webpage to PDF using wkhtmltopdf, you can use the command `wkhtmltopdf source_file destination_file.pdf`. For example, `wkhtmltopdf https://example.com example.com.pdf` will create a PDF from the specified webpage.

How can I verify the installation of wkhtmltopdf?

You can verify the installation of wkhtmltopdf by running the command `wkhtmltopdf --version` in the terminal. If installed correctly, it will display the version number of wkhtmltopdf.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

0 Comments

Leave a Comment

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

Exit mobile version