Click here to Skip to main content
15,885,944 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have some problem when i have print direct to the local as well as network printer.

I create a Web Application where Print button there, and i also create a window console application for get default printer name.

when i create to call this console application via Web API, it will be work perfectly, it will be give right result which having a default set, but when i create this console application to windows services it will be give only one specific printer every time yet i will set another printer set to default.

What I have tried:

I have tried Win32_Printer for local as well as network printer, it will give right printer name when i run console application locally, but when i try to install as windows services it will not work.
Posted
Updated 29-Jul-19 4:47am

1 solution

Your question makes no sense. Web App? Console App? Windows Service app? You didn't do a very good job of explaining what app is running where and how these apps relate to each other. What are these apps doing?

How does this "Print button" work? What is the code behind it?

"Default Printer" is a user-specific setting. So, your "console app" if you run it is going to return a different default printer than if it's run as Local System. Windows Services, by default, run as Local System.

ASP.NET web apps run entirely on a server, so the default printer for printing something from website code is going to be whatever account is running the code on the server. This is usually the default ASP.NET account.

Now, if you're printing something from the client, javascript code running in the client browser has no access to the default printer settings.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900