How to Convert HTML to PDF

By Xah Lee. Date: . Last updated: .

Convert One Single File from HTML to PDF

If you just have one single file, you can use libreoffice.

download at http://www.libreoffice.org/

on Linux, you can install by:

# install libreoffice
sudo apt-get install libreoffice

Type libreoffice to start it, then, open the HTML file, then use menu [File ▸ Export…].

Convert Multiple Files from HTML to PDF

to convert HTML to PDF on Linux, you can use wkhtmltopdf. It's based on webkit, the web browser engine used by Safari.

# install
sudo apt-get install wkhtmltopdf
wkhtmltopdf file.html file.pdf