Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call COM printing component in Silverlight

My silverlight application will have print capability, the printing module is created in separated csharp project, and call the module using this code:

m_ComPrinterContoller = AutomationFactory.CreateObject("ComPrinter.Application");

My printing module is separated c# project and will create let say ComPrinter.dll, inside of it there is select default printer and printing for every forms that need to print.

In development laptop I will build the printing module and then I run my application smoothly, but in hardware machine it error, first the error is progId is not registered, so I register my ComPrinter.dll using RegAsm, because I cannot register it using regsvr32, and now the progId is registered, there is my dll name in HKCR (I run regedit and expand the HKEY_CLASSES_ROOT).

Now it already registered, but there is new error, a dialog message: "ComAutomation_CreateInstance".

And when I install visualStudio and build the ComPrinter project, and then I run my application (not from visual studio, but from the application directly), and the application is run smoothly.

What is .net did when build and create .dll? it's kind of registering the .dll but different from regsvr32 or regAsm. Or anyone have ever meet situation? how to register .Net dll COM and call it from silverlight application, and run it not in development computer

There is similar link that ask the same question: http://support.leadtools.com/CS/forums/35174/PrintPost.aspx, but it still not have answer.

Regards, Imam

like image 919
ibaihaqi_silverlight Avatar asked Nov 27 '25 15:11

ibaihaqi_silverlight


1 Answers

Use Regasm's /codebase option as Hans Passant said

like image 170
ibaihaqi_silverlight Avatar answered Nov 29 '25 23:11

ibaihaqi_silverlight



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!