cross_bearer_02
cross_bearer_02

Reputation: 31

Remote and local printing from a C# ASP.NET application

My situation involves an ASP.NET application that I have written which should remotely print orders, as well as print a local copy for the person creating the order on the local client machine.

The process works like this: once an order has been created in previous pages and is submitted into the system, the order information is first permanently stored into an Oracle database table. The application then carries the user to a printer-friendly order page with the final order displayed and ready to print. An order page consists of some title text at the top, places for signatures and dates, and finally, a GridView object containing the information about the order (item category, item subcategory, and quantity for each ordered item).

Once this page has finished loading and is ready for printing, I need the system to do two things:

  1. Print the order information page to the default local printer on the client computer, or else call up the print dialog to allow the user to print the order information.
  2. Print the order information to a remote printer (with a known, static IP address) located elsewhere on our network where the orders get processed.

Printing to the local machine is easy to figure out, of course. I had intended to simply call the default print dialog and allow the user to print from there, or to do some similar function to allow the webpage to print locally. The difficulty comes in figuring out how to print to the remote computer. All I have available to me to specify that printer to the system is its static IP address. I don't have the shared name of the printer.

Given this information, is it possible to have the webpage print automatically on the remote printer where the orders get processed? If so, what do I need to use to do it? Also, if anyone has some sample code that might help get me started (in either VB or C#, although this project's back-end code is in C#), it would be extremely appreciated.

Thanks!

Upvotes: 3

Views: 1829

Answers (1)

thekip
thekip

Reputation: 3760

I've once implemented such a thing but the user that's running your ASP.net application should have enough rights to print (which it doesn't most of the time for obvious reasons). What I had done in order to fix this is create a client web service that accepts the document to print and sends that (it is installed on a machine in the same domain as the printer) to the printer.

Upvotes: 2

Related Questions