Are you looking for command line tools to help you render web pages to PDF or to an image?. wkhtmltopdf and wkhtmltoimage are open source tools created to be used in a command line interface which makes them fit for integration to other applications. If you’re on a Cloud platform such as AWS, you can create serverless Lambda functions to aid in conversion processing with wkhtmltopdf & wkhtmltoimage.

To install wkhtmltopdf & wkhtmltoimage command line tools on Amazon Linux 2 server you’ve to download the RPM package then use yum package manager to install it on Amazon Linux 2 system.

First install wget downloader:

sudo yum -y install wget

Once you have wget command line tool use it to pull the latest wkhtmltopdf RPM package:


Install the tool with yum:

sudo yum install ./wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm

You will be prompted to accept the installation by pressing the y key in your command:

Dependencies Resolved

 Package                             Arch                  Version                                   Repository                                              Size
 wkhtmltox                           x86_64                1:0.12.6-1.amazonlinux2                   /wkhtmltox-0.12.6-1.amazonlinux2.x86_64                118 M
Installing for dependencies:
 xorg-x11-fonts-75dpi                noarch                7.5-9.amzn2                               amzn2-core                                             2.8 M

Transaction Summary
Install  1 Package (+1 Dependent package)

Total size: 121 M
Total download size: 2.8 M
Installed size: 121 M
Is this ok [y/d/N]: y

To check release version of wkhtmltopdf use the commands below.

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

The same applies for wkhtmltoimage:

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

Usage help pages can be checked with –help command options.

$ wkhtmltoimage --help
  wkhtmltoimage 0.12.6 (with patched qt)

  wkhtmltoimage [OPTIONS]... <input file> <output file>

  Converts an HTML page into an image,

General Options:
      --crop-h <int>                  Set height for cropping
      --crop-w <int>                  Set width for cropping
      --crop-x <int>                  Set x coordinate for cropping
      --crop-y <int>                  Set y coordinate for cropping
  -H, --extended-help                 Display more extensive help, detailing
                                      less common command switches
  -f, --format <format>               Output file format
      --height <int>                  Set screen height (default is calculated
                                      from page content) (default 0)
  -h, --help                          Display help
      --license                       Output license information and exit
      --log-level <level>             Set log level to: none, error, warn or
                                      info (default info)
      --quality <int>                 Output image quality (between 0 and 100)
                                      (default 94)
  -q, --quiet                         Be less verbose, maintained for backwards
                                      compatibility; Same as using --log-level
  -V, --version                       Output version information and exit
      --width <int>                   Set screen width, note that this is used
                                      only as a guide line. Use
                                      --disable-smart-width to make it strict.
                                      (default 1024)

  If you experience bugs or want to request new features please visit

See all usage command options and flags for wkhtmltopdf:

$ wkhtmltopdf --help

You can now start using wkhtmltopdf and wkhtmltopdf tools on your Amazon Linux 2 machine.

Check other Amazon Linux 2 guides:

How To Install Terraform on Amazon Linux 2

Install and Configure Chrony NTP server on Amazon Linux 2

How To Install PostgreSQL 13 on Amazon Linux 2


  1. wkhtmltopdf: error while loading shared libraries: cannot open shared object file: No such file or directory.
    Can you please tell me how to solve this error


Please enter your comment!
Please enter your name here