.. because I wasted way to much time on finding easiest way to convert an html file to pdf , including the css :
1. On apt based Linux, install wkhtmltopdf and its dependencies :
sudo apt-get install wkhtmltopdf
2. Usage:
To convert a remote HTML file to PDF:
wkhtmltopdf http://www.google.com google.pdfTo convert a local HTML file to PDF:
wkhtmltopdf my.html my.pdfYou can also convert to PS files if you like:
wkhtmltopdf my.html my.psThe eler2.pdf sample file
wkhtmltopdf http://geekz.co.uk/lovesraymond/archive/eler-highlights-2008 eler2.pdf -H --outline
source: http://code.google.com/p/wkhtmltopdf/wiki/Usage
Creator/maintainer has also recently created some PHP bindings for this as well. More on this version at http://blog.perplexedlabs.com/2010/09/15/convert-html-to-pdf-in-php-libwkhtmltox-extension/