Check out this post to Install wkhtmltopdf on cPanel or CentOS machine. wkhtmltopdf is a tool used to render HTML into PDF. Please check the steps to install wkhtmltopdf below:

Step 1:

Install dependencies:

 
yum install xorg-x11-fonts-75dpi
yum install xorg-x11-fonts-Type1

Step 2:

There are two methods to install wkhtmltopdf on CentOS or cPanel. Install it using any of your desired methods.

Method 1: Using Source file

Download the tarball from here, depends on the architecture and OS type. I am downloading the tarball for 64 bit Linux systems.

 
cd /usr/local/src/
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar xvfJ wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
cp -r wkhtmltox/bin/wkhtmltopdf /usr/bin/
cp -r wkhtmltox/bin/wkhtmltoimage /usr/bin/

Then run:

 
wkhtmltopdf -V

Method 2: Using RPM

The rpm file is not available on the latest version of wkhtmltopdf. I am explaining the installation of wkhtmltopdf for 64 bit CentOS 7. Click on the green button to download the rpm depends on the architecture and CentOS version: Download

 
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
rpm -Uvh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

Create symlinks if the wkhtmltopdf binaries are not in /usr/bin directory.

 
ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
ln -s /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage

Check the version using the following command:

 
wkhtmltopdf -V

Step 3:

Verify the installation:

 
wkhtmltopdf http://grepitout.com/install-wkhtmltopdf-cpanel-centos/ grepitout.pdf

The PDF file will be created. That’s it!

 
Was this answer helpful? 1 Users Found This Useful (1 Votes)