Hello Linux Geeksters.

In this article I will show you how to convert .html files (webpages) to pdf files, by the command line interface.
How to install wkhtmltopdf, on Ubuntu 12.10, Ubuntu 12.04,Ubuntu 11.10, Debian Sid, Debian Wheezy, Debian Squeeze:
$ sudo apt-get install wkhtmltopdf
How to install wkhtmltopdf on Fedora 18 and Fedora 17:
$ sudo yum install wkhtmltopdf
How to install wkhtmltopdf on OpenSUSE 12.3, OpenSUSE 12.2 and OpenSUSE 12.1:
* for 32 bit systems:
$ wget -c download.opensuse.org/repositories/home:/justlikeef/openSUSE_12.1/i586/wkhtmltopdf-0.11.0_rc1-11.1.i586.rpm
* for 64 bit systems:
$ wget -c download.opensuse.org/repositories/home:/justlikeef/openSUSE_12.1/x86_64/wkhtmltopdf-0.11.0_rc1-11.1.x86_64.rpm
$ sudo zypper install wkhtmltopdf*.rpm
Now that the installation is done, let’s start converting websites to pdf.
Convert site to pdf:
Syntax: wkhtmltopdf http://www.link-to-site.com/something name-of-pdf.pdf
Example:
$ wkhtmltopdf https://www.linuxg.net/article article.pdf
Convert local html file to pdf:
Syntax: wkhtmltopdf my-file.html my-file.pdf
Example:
$ wkhtmltopdf linuxg.html linuxg.pdf
For an easier usage, I have created this function: htmltopdf () { wkhtmltopdf “$@!” ; }
Now, I only have to type htmltopdf and the arguments, instead of wkhtmltopdf and the arguments, which is not easy to remember.