SecurityException: That assembly does not allow partially trusted callers while using itextsharp dll

29. November 2012

When you are using itextsharp library on a shared web hosting server then you might get this type of error because of .net trust level being set to Medium . 


Now in order to resolve this issue you will have to rebuild the original dll source that is itextsharp source with a slight change in AssemblyInfo.cs 

You will have to Insert this Statement in it 

[assembly: System.Security.AllowPartiallyTrustedCallers]

And rebuild the same and reference the new dll and there wont be any error anymore . If you donot have source for itextsharp then you can download from this link -

If you are not able to resolve this issue then a descriptive explanation is also provided on this blog post -


Click Here 

iTextSharp ,

How to Add Header and Footer to a PDF file using iTextSharp library in .net

28. November 2012

Below is a link to a very descriptive and easy to use code for adding Header and Footer in a PDF file while using the iTextSharp library .