views:

683

answers:

1

Hello,

I am working on web application .net 3.5,asp.net,C#. In that i need to provide list of available printer at client side.

I have knowledge of how to get server side printers using

[1] System.Drawing.Printing.PrinterSettings.InstalledPrinters

[2] System.Management.ManagementObjectSearcher [using query "SELECT * FROM Win32_Printer"]

But this all regarding server side, my requirement is to get client side installed printers.

after some searching i come to know i can do this by active X control. but how?

Is there any other way to get list of client side printers?

Prompt reply will be appreciated.

Thank you

A: 

Here the trick

var oShell = new ActiveXObject("WScript.Shell"); 
sReg = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Device'
var sName = oShell.RegRead(sRegVal)
document.write(sName);

As Tim stanteford said, this method only works with IE and might not work as expected if security permission is high.

Cheers

Ramesh Vel

Ramesh Vel