In this article we will discuss about how to install wkhtmltopdf on centos 8 and simple examples to use it.
Often we find ourselves in a position where we need quick pdf files for a document that is right now is on internet. There’s is no direct way to do it from browser unless you hit online tools that turns links into pdf for you.
But do we have to trust them with our documents/information? We don’t have to, we can setup wkhtmltopdf one time on our computer or personal server and use it every time we need to create pdfs from html pages or links that we need.
Installing wkhtmltopdf on CentOS 8
We will use command below to download and install wkhtmltopdf on our CentOS 8 server:
[root@server ~]# sudo yum install -y https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm
After running above command, we can now check the installation with this command:
[root@server ~]# wkhtmltopdf --version
Run this simple command to convert google.com page to pdf file.
[root@server ~]# wkhtmltopdf --page-size A4 --quiet http://google.com google.pdf
How to check wkhtmltopdf installtion path
[root@server ~]# which wkhtmltopdf /usr/local/bin/wkhtmltopdf