How To Install wkhtmltopdf In Linux And Windows
Senny
wants to convert web page into PDF by entering website URL. Definitely your first answer is, He can use Traditional method (by right clicking on webpage and clicking on “print” option) to create PDF of website page. He has hundreds of webpages to convert into PDF. So, He is searching for something that he can easily convert website page into PDF in bulk.
It would be better If there any utility which converts HTML to PDF by entering just one command. wkhtmltopdf tool converts html to PDF or IMAGES such as JPEG, PNG etc.. wkhtmltopdf is lightweight open source tool for converting html to PDF or Image such as JPG, PNG etc. wkhtmltopdf is written in C++ programming language. wkhtmltopdf can convert any HTML web page to PDF with Options to add Header and Footer. It is available under GNU/GPL license. Checkout Official site of wkhtmltopdf for latest changelog.
wkhtmltopdf is supported in all the well known operating system such as Windows, Linux and Mac etc. So, How to install wkhtmltopdf in Linux base system?
Download wkhtmltopdf’s executable setup from official site. It’s available for both 32 and 64 bit system. Now, Install wkhtmltopdf by running setup.
It is available for both versions of system (32 and 64 bit Linux systems). We will install wkhtmltopdf from command line, which is a non-graphical way to interact with your computer. You need root access to install wkhtmltopdf in linux.
So, Let’s open terminal by hitting ctrl+alt+t
. Now, run sudo -i
command to login with root user. You can also use su - <User>
where <User>
is root user name. Enter root password to login.
Run below command to install wkhtmltopdf in your system.
apt-get install wkhtmltopdf
Now, create test PDF by enter below command in linux terminal.
wkhtmltopdf <Website URL> <Output File Name>
Where,
<Website URL>
is website URL which you want to convert to PDF.
<Output File Name>
is filename with path where you want to save output.
Ex, wkhtmltopdf http://www.google.com /home/user/output.pdf
Above command will create PDF file of google.com
site at /home/user/output.pdf
.
In windows system open command prompt and run above command to comvert HTML to PDF.
Ex, wkhtmltopdf http://www.google.com C:/output.pdf
Nawaz Ali
Really an excellent article. I like your blog very much. You are really a new star in blogging:)