Category Archives: ASP.NET

iTextSharp

I was looking for a shortcut to avoid having to rebuild an entire document again that is currently being displayed in an ASP.net Panel  and instead just export it to PDF. This lead me to iTextSharp library which is used in Java, .NET, and Android.

First problem is that there is zero documentation for this library. Free tool but apparently they want to sell a book about it.

The concept was relatively simple to parse the panel as html and then write to the PDF, but it just starts to choke quickly. Using a grid inside the panel requires an override of the VerifyRenderingInServerForm function to avoid an exception.

Using my test environment it breaks on path access issues to images in the panel.

Then you have to remove all of the css styles that control fonts – larger, smaller, etc. You have to specify the exact point size for the parser to handle it.

Then when you see the final result it is just horribly manged by the formatting it does to the document.

This might be a decent tool in other circumstances, but today it is just not worth the effort to figure out what they want to get it to work properly without any proper documentation.