[HowTo] Convert Webpage/HTML to PDF on Ubuntu Linux

preview_player
Показать описание

There are numerous ways one can convert a web page (HTML) to PDF. Here is how to do it in 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:

The output of wkhtmltopdf is pretty good. Take a look:

wkhtmltopdf result

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
Рекомендации по теме
Комментарии
Автор

this is exactly what i need. thank you very much.

decibyte
Автор

Can I do that with a normal html file. Because I want to convert a html file into a pdf file, it's from a book. I'm e newbie with that stuff, so I hope you can help me.

DatKisu
visit shbcf.ru