How I installed wkhtmltopdf in my CentOS Server

I am working on a Laravel 5.8 web application which is hosted on a shared server managed with Plesk. I am trying to replace domPDF with laravel-snappy for generating large PDF reports. I need to install wkhtmltopdf binary in my CentOS7 server as a dependency for laravel-snappy.

  1. Manage dependencies for wkhtmltopdf installation:

    Make sure in your server these dependencies are installed: fontconfig, libXrender, libXext, xorg-x11-fonts-Type1, xorg-x11-fonts-75dpi, freetype, libpng, zlib, libjpeg-turbo.

yum info <package_name>
// Check if a package is installed in your server with this command.
  1. Install dependencies:

    xorg-x11-fonts-Type1 and xorg-x11-fonts-75dpi package was missing in my server. So I tired to install these with yum install and I failed. So I installed these packages from an external source.

yum install <package_name>
// Install dependencies of wkhtmltopdf

wget http://mirror.centos.org/centos/7/os/x86_64/Packages/xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm
yum install xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm
// Install xorg-x11-fonts-Type1 from external source.

wget http://mirror.centos.org/centos/7/os/x86_64/Packages/ttmkfdir-3.0.9-42.el7.x86_64.rpm
yum install ttmkfdir-3.0.9-42.el7.x86_64.rpm
// Install ttmkfdir only if this package is missing.
  1. Install wkhtmltopdf from external library source
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm

yum install wkhtmltox-0.12.6-1.centos7.x86_64.rpm
  1. Verify Installation of wkhtmltopdf
wkhtmltopdf --version
  1. Complete installation of laravel-snappy according to the official documentation