How To: Convert webpage HTML to PDF on Ubuntu Linux

Convert webpage HTML to PDF on Ubuntu Linux

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.

Just updated your iPhone to iOS 18? You'll find a ton of hot new features for some of your most-used Apple apps. Dive in and see for yourself:

Be the First to Comment

Share Your Thoughts

  • Hot
  • Latest