How to install wkhtmltopdf plugin on different servers
Introduction :
This document will guide you to install wkhtmltopdf on your server.
Wkhtmltopdf is an open source simple and much effective command-line shell utility that enables user to convert any given HTML (Web Page) to PDF document or an image (jpg, png, etc).
It uses WebKit rendering layout engine to convert HTML pages to PDF document without losing the quality of the pages. Its is really very useful and trustworthy solution for creating and storing snapshots of web pages in real-time.
1. Linux Distros
Follow the below steps to install wkhtmltopdf on your server.
For Alma Linux 9, Rocky9 and RHEL9
Install different fonts to support wkhtmltopdf.
yum install -y xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi
Download the rpm package from github
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm
Install the package.
sudo dnf install ./wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm
For Ubuntu 18.04, 20.04 and Debain
For Ubuntu 18.04, 20.04 and Debian type the below command, it will install the package along with all the required fonts.
apt-get -y install wkhtmltopdf
For Ubuntu 22.04
For Ubuntu 22.04 run the below commands to install the package.
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
apt-get update
apt install libssl1.1 -y
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb
apt --fix-broken install -y
2. Windows Servers
Follow the below procedure to install wkhtmltopdf plugin on windows server with IIS or Apache webserver.
- Click Here to download 64-bit wkhtmltopdf-0.12.6-1.exe installer file.
-
Run the downloaded wkhtmltopdf-0.12.6-1.exe installer.
-
Click I Agree on the license agreement screen.
- Specify the installation destination folder or leave it as default location and click Install
- When installation is complete, click the Close button.
-
Now copy wkhtmltox.dll located at C:\Program Files\wkhtmltopdf\bin and paste it in C:\php8.1\ext (C:\php8.1\ext - incase of Apache)
-
Update the Environmet variable for wkhtmltopdf.