When you may need to convert a complete web page in html to a pdf file, Linux can help you.
We will need two tools:
You should be able to install both of them using your package manager.
To be able to convert the html to pdf, we will follow a two stage process.
To do that enter this command:
wget -p [url to download]
I will first create a folder to store the page, so.
Then download the web page:
cd /tmp/download-folder wget -p http://www.go2linux.org/mt/linux-ht/2010/10/new-branch-on-debian-1.html
That will create a structure like this:
There you will find the file, new-branch-on-debian-1.html
Enter into the folder where the html file is.
Convert the file.
Using this format
wkhtmltopdf [html file] [pdf file]
wkhtmltopdf new-branch-on-debian-1.html new-branch-on-debian-1.pdf
That is it, you now have converted a complete html file including format, css, etc. to a pdf file, that you can send by email, archive, or anything you want.
Note: If the page you are downloading does not have .html extension you may get errors, to solve that, just mv (rename) the file to have an .html extension. Now a days, most of the pages does not have .html extensions.
If you enjoyed the article, please share it