I've written an ASP.NET (VS 2005) application that will print a receipt automatically when a command button is pressed. Here is an excerpt of the code that I am using to do this:
Dim printFont As New Font("COURIER NEW", 12)
Dim pd As New PrintDocument()
AddHandler pd.PrintPage, AddressOf pd_PrintPage
pd.PrinterSettings.Copies = 2
' Specify the printer to use
pd.PrinterSettings.PrinterName = "\\awnse01\Generic"
If pd.PrinterSettings.IsValid Then
pd.Print()
Else
lbError.Text = "Printer is invalid."
End If
The client name is awnse01and server name is webserver1. The printer is installed on uhaditse02 and application resides on webserver1. However, when I go to print, it will NOT print.
The only way it will print is if I turn the client (awnse01) into a web server and run the application locally. I then change this line of code to the following:
pd.PrinterSettings.PrinterName = "Generic / Text Only"
While it works and I can go with this arrangement as a last resort, I'd rather not due to security reasons. And there is no sense in having more than one copy of this application on the network.
How would I allow a program running on the server to control a printer attached to the client?
I tried impersonation and running the program as my personal username. I also tried giving permissions to the local printer, but it still did not print. Can anyone help? This is urgent and any help would be GREATLY appreciated!
Dim printFont As New Font("COURIER NEW", 12)
Dim pd As New PrintDocument()
AddHandler pd.PrintPage, AddressOf pd_PrintPage
pd.PrinterSettings.Copies = 2
' Specify the printer to use
pd.PrinterSettings.PrinterName = "\\awnse01\Generic"
If pd.PrinterSettings.IsValid Then
pd.Print()
Else
lbError.Text = "Printer is invalid."
End If
The client name is awnse01and server name is webserver1. The printer is installed on uhaditse02 and application resides on webserver1. However, when I go to print, it will NOT print.
The only way it will print is if I turn the client (awnse01) into a web server and run the application locally. I then change this line of code to the following:
pd.PrinterSettings.PrinterName = "Generic / Text Only"
While it works and I can go with this arrangement as a last resort, I'd rather not due to security reasons. And there is no sense in having more than one copy of this application on the network.
How would I allow a program running on the server to control a printer attached to the client?
I tried impersonation and running the program as my personal username. I also tried giving permissions to the local printer, but it still did not print. Can anyone help? This is urgent and any help would be GREATLY appreciated!