Last Updated: February 25, 2016
· everton_agner

How to export any HTML page to PDF

wkhtmltopdf is what you need!

Basically, you need to call it from the command line, but you can easily integrate it to any web application using some server-side skills.

Sample usage:

wkhtmltopdf.exe myhomepage.pdf

The best thing is that you can also do that on session-dependent pages! The trick is that you have to capture your SessionID somehow and use it on the command line:

wkhtmltopdf.exe --cookie cookiename jahnvyp2yhcbi4sjxcrsnh3 "" mywebpage.pdf