How to Install wkhtmltopdf on cPanel/ Centos Server

wkhtmltopdf is an open-source command-line tool to convert HTML into PDF. It is widely used by applications to generate invoices and other pdf documents. for example, a python or PHP script will use it through its respective shell command to convert any URL to a PDF.

The use is very easy, simple call wkhtmltopdf from the terminal with source URL and destination pdf name. for example

If you want to capture a google doodle (whenever there is) you can the command will be


wkhtmltopdf mydoodle.pdf

or want to keep the current version of Twitter to save your trending tweets records,

wkhtmltopdf mytweets.pdf

Installing wkhtmltopdf  on cPanel

Installation is pretty straight forward as would any rpm package.

  1. Download

    Download the appropriate version from For sake of this article, our server is running centOS 7.9 with cPanel version v92.0.5. Please note that all downloads are currently on GitHub, so you can also browse for a specific download from there or use the links below. There are many other sources that you can found by googling it, but as a rule of thumb always go for an official source.The package also includes wkhtmltoimage (used to convert any webpage/ URL to a number of image formats) sources and hence is named as wkhtmltox

  2. wget
    --2020-12-19 10:52:56-- oad/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
    Resolving (
    Connecting to (||:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Resolving (
    Connecting to (github-pr||:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 14071376 (13M) [application/octet-stream]
    Saving to: ‘wkhtmltox-0.12.6-1.centos7.x86_64.rpm’100%[======================================>] 14,071,376 10.8MB/s in 1.2s2020-12-19 10:52:58 (10.8 MB/s) - ‘wkhtmltox-0.12.6-1.centos7.x86_64.rpm’ saved [14071376/14071376]
  3. Install

    To install wkhtmltopdf RPM that we just downloaded, use the following command

    sudo rpm -i wkhtmltox-0.12.6-1.centos7.x86_64.rpm

    The -i switch is of course instructing rpm to install the package

    Or alternately you can use yum package manager, use the following command with localinstall option, instructing yum to look within the current directory for wkhtmltox RPMsudo yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm

  4. Test

    Test executable while converting the homepage of into pdf. On WHM/cPanel terminal window or on SSH console use following command

    wkhtmltopdf my-favorate-webhosting-blog.pdf
    Loading pages (1/6)
    Counting pages (2/6)
    Resolving links (4/6)
    Loading headers and footers (5/6)
    Printing pages (6/6)

and wooha, Its all done

The .htaccess is a hidden text file that contains some additional configuration for the websites hosted on an apache server, and it can directly affect how your website behaves in certain situations. By using .htaccess, you can rewrite the URL, Redirect your website. Password-protect your directories and disable access from a spec