Posts

Showing posts from 2013

MVC - SSL, Testing and Production Nuget Package Released

Following on from my earlier post regarding awareness of SSL flag removal that can cause security holes ending up in released code from a development environment, I've released RemoteRequireHttps as a package on Nuget.org

Please download and use as required!


HTML to PDF Conversion in MVC 4

My preferred tool for dynamically creating PDF documents in a web application is iTextSharp (http://sourceforge.net/projects/itextsharp/) however, I recently had a PDF generation problem to solve where iTextSharp couldn't help.

One thing that seems to be an issue is the generation of PDF documents from HTML, and ensuring CSS used to style the HTML is included in the generation. If the CSS is not included, then the resulting PDF can be greatly different from the source HTML. This can be a problem if for example you need to convert a HTML page returned from a third party's webservice. You have no control over the source HTML, but need the PDF to be styled as per the returned HTML. This situation is commonly encountered with invoice generation, delivery label generation, that sort of thing.

There is an excellent program available that will convert HTML to PDF and preserve all styling, however it is  a command line program - wkhtmltopdf (http://code.google.com/p/wkhtmltopdf/). The s…