How to print from a web application to a local printer with C #

4

I need to schedule some of the local printing features on the web where texts and commands are sent to a specific device without user interaction . For example, labeling Zebra and Argox equipment and printing non-tax coupons on Bematech MP20 printers.

What is the most efficient way to solve this issue with C #?

The only chance I thought was to create a support application to be installed on the desktop, but I'm not sure, there would be two possibilities:

1) Develop an application as WCF service installed on the desktop and make the web application call. (I think in this case there would have to be firewall configuration and port forwarding, to allow access and this would not be practical due to the volume of users accessing various environments)

2) Create a service (ASMX) on the server and a desktop application that periodically checks the service to see if there is any activity to be performed, then performs the task locally. (But I worry about how busy this service will be even when there is no printing)

Do you find any of these options feasible? How would you solve it?

    
asked by anonymous 13.09.2017 / 13:04

2 answers

2

The server side you can do as you want as long as it serves the information you need the way you need it. Particularly I avoid doing web because it has disadvantages. It took fashion people want it to be web. Making web has the advantage to websites , in some cases much rarer than people imagine it can be useful for applications , but in general the experience with the user is impaired and not a good idea. Unfortunately it seems like something no one else gives ball anymore. The performance of serving over HTTP is not good.

The client side really needs to do something that has full access to the computer and should be a desktop application. You can even make the application run in the browser and a desktop helper, but it is gambiarra and rarely justified. The user experience will suffer.

Personally I would not use WCF, I'd rather use Direct TCP to communicate with the server. If you want to make web on the server even then communicate over HTTP. I think WCF is a hard-to-handle, slow and cumbersome but I prefer WCF well done by TCP than web application.

Setting up a firewall is not a problem, it can be done programatically, I would not stop doing something better for a lifetime because it will give me an extra job once. I do not understand why people think it's a problem.

Even if I choose to do HTTP, I would use ASP.NET Core or at least ASP.NET MVC, it would not go from classic ASP.NET in any case, it is obsolete. MVC is one too, but it's recent.

If you do the right thing, there will be no problems with processing overhead. Can do without fright he checks periodically. OR can make a signature system on the server that the server notifies when it has something relevant to the subscribing clients. It depends on the volume of each thing and the need for agility in having the news, one or the other may be better.

    
13.09.2017 / 14:01
0

I participated in several projects using similar structure, but the printers were on the server side .. Systems where I had an ASP.NET application and this application made impressions on Zebra printers, I even have the framework ready for printing if I need to, I can put it in Github.

What I did was create a WebService and publish it on the server where the printer is installed, remember that WebService (ASMX) running on IIS (Application Pool) should have permissions to perform the printing, this was a of problems, so we put a user with permissions in the IIS ApplicationPool of the WebService to perform the printing.

So in the Print call of the [WebMethod] it would receive the printer name as the parameter.

The application runs for a few years and we never had any problems, so the project in question was the best solution, where we had more than 10 Zebra printers installed on the server.

    
13.09.2017 / 15:49