Skip to content
Follow
Ubuntu Linux

How to Install wkhtmltopdf & wkhtmltoimage on Ubuntu Linux

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

wkhtmltopdf and wkhtmltoimage are command-line tools for Ubuntu Linux that convert web pages directly into PDF documents or image files. They use the Qt WebKit rendering engine to process pages in the background without needing a display screen or a graphical desktop.

Advertisement

You can use these utilities to automate report generation and save web content straight from your server or apps. Setup takes about 5 minutes on a standard Ubuntu system.

⚡ 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’.

Advertisement

Install wkhtmltopdf & wkhtmltoimage

To install wkhtmltopdf Ubuntu packages correctly, download the correct .deb file straight from the project website rather than using the old repository version. This manual method gives you the latest features and fixes bugs that cause rendering problems on your server.

For the latest version, 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:

Advertisement

Before installing the tools, make sure your system has the required software packages by running:

sudo apt update 
sudo apt install wget xfonts-75dpi

Then run the commands below to download and install.

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:

Advertisement
sudo apt -f install

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

wkhtmltopdf --version

The output should look similar to this:

wkhtmltopdf 0.12.5 (with patched qt)

Next, run this command:

wkhtmltoimage --version

This will produce output like this:

Advertisement
wkhtmltoimage 0.12.5 (with patched qt)

Use wkhtmltopdf & wkhtmltoimage

You use wkhtmltopdf and wkhtmltoimage from your terminal by typing the command followed by the web address and the file name you want to save. This command line tool processes the webpage in the background and saves a clean copy directly to your folder.

The syntax below is how to use wkhtmltopdf.

wkhtmltopdf  source_file    destination_file.pdf

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

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

The web content will be generated into a PDF file.

Advertisement
💡TipFor more details on using the command, check out this page:

wkhtmltopdf and wkhtmltoimage are now ready to generate PDFs and images on your system. If you find any error, please report it in the comment form below.

Thanks!

You might also like this post:

Was this guide helpful?

100% of readers found this helpful (2 votes)

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.

Advertisement

📚 Related Tutorials

How to Install Python on Ubuntu Linux
Ubuntu Linux How to Install Python on Ubuntu Linux
How to Install Ubuntu Linux
Ubuntu Linux How to Install Ubuntu Linux
How to Install ClamAV Antivirus on Ubuntu Linux
Ubuntu Linux How to Install ClamAV Antivirus on Ubuntu Linux
How to Install WildFly on Ubuntu Linux
Ubuntu Linux How to Install WildFly on Ubuntu Linux

0 Comments

Leave a Comment

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