Header Banner
wonderhowto.mark.png
Gadget Hacks Next Reality Food Hacks Null Byte The Secret Yumiverse Invisiverse Macgyverisms Mind Hacks Mad Science Lock Picking Driverless

How to Convert webpage HTML to PDF on Ubuntu Linux

Dec 14, 2009 04:25 PM
BBC homepage with news headlines and a world map.

There's plenty of reasons why one would want to convert a webpage to a PDF document. And there's numerous ways on how one can convert that web page (HTML) into a PDF file. Check out this video tutorial on how to convert webpage HTML to PDF on Ubuntu Linux.

You could just select "Print" (in Firefox: File… Print), and then select "Print to file" and the output "PDF".

But some pages with lots of CSS, javascript, and so on, won't be displayed correctly. For this, see the second method of converting webpages (HTML) to PDF (below).

Using wkhtmltopdf:

To install wkhtmltopdf in Ubuntu, run the following command in a terminal:

sudo apt-get install wkhtmltopdf

Then, to convert a webpage to PDF, open a terminal and type this:

wkhtmltopdf http://www.bbc.com ~/Desktop/bbc.pdf



Replacing http://www.bbc.com and bbc.pdf with the website you want to convert to PDF / the name you desire for the converted PDF file.

With wkhtmltopdf, you can disable the javascript on the page if you want, change the quality, orientation (portrait or landscape), and more. Too see everything wkhtmltopdf can do, type:

wkhtmltopdf --help

Tru3m0sl3m has all kinds of tutorials, from Windows and Ubuntu Linux operating systems to Islamic videos. If you're looking for some quick and handy computer tips or tricks, this is a good place to start.

You already know how to use your phone. With Gadget Hacks' newsletter, we'll show you how to master it. Each week, we explore features, hidden tools, and advanced settings that give you more control over iOS and Android than most users even know exists.

Sign up for Gadget Hacks Weekly and start unlocking your phone's full potential.

Related Articles

Comments

No Comments Exist

Be the first, drop a comment!