Asp.Net MVC Action Result Converting Html To Pdf

Every time I go to solve the problem of converting html to pdf I am overwhelmed with the number of paid vs open source vs not-working vs 404 results I get on the topic. After my digging I decided to write an action result for asp.net mvc 3 allowing users to pass in html and css; getting a sweet pdf download.

Lets start with the libraries:

 Now that we have the dependencies out of the way throw this class in your application:

And for the implementation:

Note: If you get build issues with the HtmlToPdfBuilder on line 207 just comment the line out. That is what I did and it seemed to work fine.

Thanks, Hugoware for the cool pdf wrapper.

There are a ton of things that could be made better of course, but this should get someone started for sure.

Happy Coding