Network printing with window service - c#

I have a friend who did the same thing with window form.
What I need is to make this to a window service.
The Window service program (printing controller service) will be used as a central printer controller.
Depending on the condition, I will send the printing job to different printer on the network (the printer is installed on USB).
It is already possible to do a test print, but when I list down the installed printers, these network printers are not listed.
But in my friend's program, all he need to do is to set the printer name to the ip address of the machine, and for that machine, just make sure that it is set to the default printer.
Once my friend set the ipaddress and trigger print, it will be printed to the correct printer. But for my case, the window service already did not list down the network printers, it will not print if printer name is wrong.
For my window service, I'm using Local System.
heard about creating a local port with the relevant IP address of the printer, but have yet to manage to test.
Hope that someone is able to give some guidance

Printing from a windows service is not recommended. Windows service runs in background and have no UI.
You can look into:
Print html document from Windows Service in C# without print dialog
EDIT
"For my window service, I'm using
Local System."
I guess you need to use a different account for your service,( domain account) so that you can access network resources.

Have sort of gave up on using window service, as when I log down the printers my computer can access, it will only show only those installed locally, those network printers are not recognized somehow.
Tried with standard TCP/IP port, have no problems setting up, but unable to even do a test print.
Decided to trade off by using window form, setting the default printer according to the mapping and issue a print command. Tested and it worked. This way, the user will only need to login the computer each day, but the advantage is that there will be no issue for the need of additional settings with regards to permission and access rights

Related

Use of redirected printer with RDP on windows server with winforms application

I noticed that each time I login with RDP on a windows server, my redirected printer get a different name based on my RDP ID.
In my winforms app I need to print a pdf file directly to the redirected printer without user intervention for confirming.
As I understand, the assigning of the printer to use is based on it's name.
But while the name of the printer keeps changing, this doesn't seem to be the way to address this issue.
On a regular pc it just works fine, because you than have a fixed name for the network printer.
I'm looking for some advice on how to get a better solution for this.

how to access usb port of client pc from web app

I have a web app. now I want to add "present and absent by finger print" to this. everything work fine in localhost (add finger,remove finger and etc). I send device port name to functions to do jobs.
but after publishing project I recognized that it can not find port in client's pc.
now I want to now how can I access specific port in client's pc after publishing web app?
PS:if you need to know part of code just say it to show you, thank you
Browsers don't let you to do it on purpose. However, you can create ActiveX objects, plugins or browser extensions to do it.
For example you can check this
I have understand the best way is windows application, so I did my job by creating c# windows application and did my job as well as I wanted.

ASP.NET Web service generate DUPLICATE print jobs

I am develop a ASP.NET (SOAP) web service for print KOT/BOT print outs . I am using "PrintDocument" class for handle print jobs and the printer is Epson TM U220 network printer. The problem is when calling the print web method sometimes its generate DUPLICATE print outs. But according to my system logs, from the web method call print function only onetime, but from the Printer (Epson TM U220) generate same print out twice. Also this not happening every time. We are also unable figure out in which point this issue is occur.
Also this problem not occurring in our office testing environment. This happening our one client site only. Customer complain time to time, system generate DUPLICATE KOT/BOT printouts. And also their not using dedicated server PC for the IIS server and SQL server database. Their using standard shared PC for system. So is this a problem of the web service, IIS server or the Hardware (System PC or LAN Network communication between PC and the Printer)?
By the way is this AutoCutter or not? Epson has a "Serial emulation driver" that makes a USB printer act like it's on a real serial port. Then you can use direct-to-port in Campground Master, set up as a serial printer and test it whether its keep hapenning duplicate printing. but you might need to use service to talk to port in the destination computer (local port printing) we did sometime when we had simillar issue.May be this help to you

Printing WCF - network printing issues [duplicate]

I get the error mentioned when printing to a network printer.
The error does not occur when run under XP/Win2003, in a WinForm app or when a local printer is used.
The error does only occur when run as a Windows Service under Vista/Win7/Win2008 and printing to a network printer.
The Windows service runs under a network user that has access to the network printer. Before I print I check if the printername (including network path) is ok by looping through the available printers.
How can this be solved?
Solved by adding the printer to the SYSTEM user via a registry hack as described in the Microsoft doc: http://support.microsoft.com/kb/184291/en-us.
For anyone that stumbles across this issue in the future.
Double check that your Printer Name is correct as it could also be the reason you might be getting this error.
In my case we got same error for windows 10 os client computers.
I think the error is related users and their permissions.
After making the client computers to our company's domain the error was fixed.

Printing Server Side from .Net (without WinForms)

Hey printing junkies need some pointers to send me in the right direction for this development.
I am developing an epos system for a local shop which we are later going to tie into an ecommerce site.
The front end of the epos system is going to be WinForms so we can handle USB devices easily and we are going to use a WebForms/MVC admin console.
One area we are inexperienced in is printing. We need to print barcodes, and wish to do this via the admin console (web based).
So (finally) the question. Where do we start looking for code that will allow us to print directly to a connected printer from the server (IIS) instance of .net from the webforms.
System.Drawing.Printing
http://msdn.microsoft.com/en-us/library/system.drawing.printing.aspx
Creating the document is a lot like creating a dynamic image. I have not actually sent a document to the printer from a web app, but I don't see why you couldn't.
Your Web app will probably have to use remoting to connect to a Windows service running on the same machine (or pick your favorite IPC mechanism—perhaps a queue in a database). This service can run in an full trust context and should be able to print for you.
You can set up a local printer, that just passed traffic through to the network printer. This is easier to set up that printing direct to a network printer. See link text

Categories

Resources