How to Install Wkhtmltopdf

What is Wkhtmltopdf

Wkhtmltopdf is a command-line tool in Ubuntu, Windows and other OS that converts HTML and web pages into PDF files using the WebKit rendering engine. It’s widely used for creating PDFs from web content, including reports, invoices, and documentation. The tool can handle CSS, JavaScript, and other web technologies, producing PDFs that look very close to the original web pages.

How to Install Wkhtmltopdf

It supports various options for customizing the output, such as setting page size, margins, headers, footers, and more. Wkhtmltopdf is available for Linux, Windows, and macO operating system.

How to Install Wkhtmltopdf in CentOS/RedHat Linux

How to Install Wkhtmltopdf in CentOS/RedHat Linux

1. Download the RPM package

  • First of all, download the wkhtmltopdf in CentOS/RedHat Linux by using command as following.sudo yum install -y https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm

2. Install wkhtmltopdf

  • After complete the downloading, you have to install it by using command as following.
    sudo yum localinstall -y wkhtmltox-0.12.6-1.centos7.x86_64.rpm

3. Verify the installation

  • Write command as following to check its version.
    wkhtmltopdf --version

How to Install Wkhtmltopdf in Ubuntu Linux

How to Install Wkhtmltopdf in Ubuntu Linux

1. Update your package list

  • First of all you have to update your package list and install necessary dependencies on your Ubuntu Linux operating server by this command.
    sudo apt-get update && sudo apt-get install -y software-properties-common

2. Add the official repository

  • Now add official repository in your Ubuntu operating server by this command.
    sudo apt-add-repository -y "deb http://security.ubuntu.com/ubuntu xenial-security main"

3. Install wkhtmltopdf

  • After updating packages, installing dependencies and adding repository, install wkhtmltopdf in your Ubuntu server by given command as following.
    sudo apt-get install -y wkhtmltopdf

4. Verify the installation

  • Open a Command Prompt and run
    wkhtmltopdf --version

How to Install Wkhtmltopdf in Windows

How to Install Wkhtmltopdf in Windows

1. Download the installer

  • Go to the official downloads page i.e. https://wkhtmltopdf.org/downloads.html
  • Download the installer for Windows.

2. Run the Installer

  • Follow the installation wizard steps.
  • Ensure to add `wkhtmltopdf` to your system's PATH during installation.

3. Verify the installation 

  • Write command as following to check its version.
    wkhtmltopdf --version

How to Install Wkhtmltopdf in macOS

How to Install Wkhtmltopdf in macOS

1. Using Homebrew

  • If you don't have Homebrew installed, first install it using the following command:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  •  Then install `wkhtmltopdf`
    brew install wkhtmltopdf

2. Verify the installation

  • Write command as following to check its version.
    wkhtmltopdf --version
Previous Post Next Post