Skip to content
Follow
Ubuntu Linux

How to Install wkhtmltopdf & wkhtmltoimage on Ubuntu Linux

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

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

These are essential command-line tools that transform HTML into PDF files and image formats. They leverage the Qt WebKit rendering engine, mimicking how web browsers display content, and operate headlessly without needing a desktop environment.

Many developers integrate these utilities into web applications for automatic report generation. This tutorial specifically guides you through installing them on Ubuntu 18.04 and 16.04.

⚡ Quick Answer

Install wkhtmltopdf and wkhtmltoimage on Ubuntu by first updating apt and installing wget and xfonts-75dpi. Then, download the .deb file from the wkhtmltopdf website and install it using dpkg. Finally, run ‘sudo apt -f install’ if needed and verify with ‘wkhtmltopdf –version’.

Install wkhtmltopdf & wkhtmltoimage

You can easily install wkhtmltopdf and wkhtmltoimage on Ubuntu using the apt command, but for the very latest version, it’s best to download the .deb file straight from the official website.

To get the latest, you’ll want to download the .deb file directly from the project’s website.

The current stable version, as of June 11, 2018, is 0.12.5.

Always check the downloads page for the newest release:

First, make sure you have the required packages installed. If not, run these commands:

🐧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 encounter any issues during installation, try these commands:

🐧Bash / Shell
sudo apt -f install

After installation, you can check if they’re working by running these commands:

💻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

Once installed, you can use wkhtmltopdf to turn webpages into PDFs, and it can even include things like a cover page or table of contents.

The syntax below is how to use wkhtmltopdf.

💻Code
wkhtmltopdf  source_file    destination_file.pdf

For example, to convert the example.com webpage into a PDF, run these commands:

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

The web content will be generated into a PDF file.

For more details on using the command, check out this page:

That’s it!

Conclusion:

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

Thanks,

You may also like the post below:

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.

📚 Related Tutorials

How to Turn "Week Numbers" On or Off for Calendar in Ubuntu Linux
Ubuntu Linux How to Turn "Week Numbers" On or Off for Calendar in Ubuntu Linux
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04

0 Comments

Leave a Comment

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