views:

28

answers:

2

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

+1  A: 

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.

PRR
In a way i have no issue printing on local printer already. only network printer side. tried to make it a local port. but even through local port, I'm unable to do a test print
C_Rance
check whether your current account has network access? could be access problem
PRR
Definitely have network access, it is the same account I used to do my work, as well as to surf the net, also to do network printing
C_Rance
A: 

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

C_Rance