Showing results for 
Search instead for 
Did you mean: 

System.Security.SecurityException using pdf writer in built application

I am using the Simplicity AI PDF toolkit . It works great on my developer system but when I build an application and try to print PDF I get the following:


Error 1172 occurred at Error creating instance of Writer in assembly Writer, PDF Generator, Version=, Culture=neutral, PublicKeyToken=null, (System.Security.SecurityException: That assembly does not allow partially trusted callers.)


Possible reason(s):

LabVIEW:  A .NET exception occurred in an external assembly. For information about correcting this error, copy the following exception (in bold), and search the Microsoft Developer Network (MSDN) Web site or the Web for a possible explanation.
System.Security.SecurityException in SAI_PDF_Toolkit.lvlib:SAI_PDF_Create>SAI_PDF_Toolkit.lvlib:SAI_PDF_New>Open New>DF Data Viewer Application


The API calls PDF Generator.dll and I guess that causes the System.Security.SecurityException.


Oh Joy..... /sarcasm


Pleeze hep me

0 Kudos
Message 1 of 7

What did the information on MSDN suggest?

Verne D. // Software R&D // National Instruments
0 Kudos
Message 2 of 7

I turns out that this exception can be thrown when the dll is on a external or mapped drive. In my particular setup corporate policy is to place My Documents on a corporate server to be backed up daily. At least I hope that's the deal. I'll move the executable and dll to my local drive and see if that cures my ills. (Yep that fixed it!!! Hooray, do I get to give myself kudos?)


This artical pushed me in this direction.

Message 3 of 7

I think self kudos are in order.

Verne D. // Software R&D // National Instruments
0 Kudos
Message 4 of 7

Hi, I have the same problem with the pdf Toolkit. But I do not have any external driver or something else. Everything is in local. When I built the exe it create the folder "data" into my project folder. It contains the "PDF Generator.DLL".


Pls, could you tell me how you fixed it?


Thanks a lot.

0 Kudos
Message 5 of 7



I had the same problem, to fix it you have to add itextsharp.dll and pdf generator.dll files to your project (they should be in your \user.lib\SAI_PDF_API\_Dlls folder. Then add them into the build spec as always included files, that way they will both end up in your data folder.


Hope you get it working!

0 Kudos
Message 6 of 7

Thank you very much.


I will try!

0 Kudos
Message 7 of 7