I want to select printer in Silverlight program, just like ATM or POS that will automatically print without selecting printer.
I browse internet and found: http://bytes.com/topic/c-sharp/answers/255914-set-default-printer-machine, it says that using System.Management package, using ManagementObject and ManagementBaseObject class, but I cannot add/import the class.
How to add using System.Management in Silverlight, or is any other way to selectt printer in silverlight code?
Regards, Imam
You can't do this natively in Silverlight. The System.Management
"package" (as you call it) is not compatible with the Silverlight runtime, its designed for the full .NET CLR.
If you are running OOB with Elevated Trust then you may be able to use the AutomationFactory
to achieve this goal:-
var scriptNetwork = AutomationFactory.CreateObject("WScript.Network");
scriptNetwork.SetDefaultPrinter("nameOfPrinterToSetAsDefault");