Sandeep Kumar

Sandeep Kumar

  • NA
  • 39
  • 34.1k

Find Printers Name Of client Side

Sep 13 2011 8:01 AM
I am very new to .NET development. I have a web application that accepts some data and saves it to the server. When the user selects the save option the same time I need a receipt to be printed and  I am not able to send the receipt to the default printer on the client machine. When I use the following code,

printname = pd.PrinterSettings.DefaultPageSettings.PrinterSettings.PrinterName
reportDocument1.PrintOptions.PrinterName = printname
reportDocument1.PrintToPrinter(1, False, 1, 1)

if I run from the Server using the IE brower it gives me error saying no default printer installed. But if I hard code the printer name I am able to print to the printer that is hard coded. But now the problem is when I access from the client machine through the browser i cannot print it to the printers installed on the client machine. Can any one please help me out.. It is quite urgent  requirement. Is there any other way to detect the client's default printer installed and send the report to the printer without displaying on the page and asking the user to select the File -> Print Option of the browser. Any idea to achive this is welcome.....

Answers (4)