Last Updated: February 25, 2016
·
2.007K
· everton_agner

How to export any HTML page to PDF

wkhtmltopdf is what you need!

https://code.google.com/p/wkhtmltopdf

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 www.myhomepage.com 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 "http://www.mywebpage.com/1234" mywebpage.pdf