Solved

Print a file in network printer

Posted on 2011-02-17
6
883 Views
Last Modified: 2012-05-11
Hello,
I have to print files from my .net program to a network printer. Please see attachment for printer settings.

1. I know file path of the file to print
2. I know printer uri as you can see in the attachment
3. The printers are in the network and are not installed on the machine I want to print from

I am investigating ways to print files on a network printer using a .net program (asp.net). Please point me in right direction printer sample settings
0
Comment
Question by:kolakanuru1
  • 4
  • 2
6 Comments
 
LVL 14

Expert Comment

by:quizwedge
ID: 34922157
Check out http://aspalliance.com/462_Printing_an_ASPNET_Web_Form_When_It_Is_Submitted.all I haven't walked through the code, but they claim to have the code to do what you want to do.

If that doesn't work, you could try using classic ASP as shown at http://www.asp101.com/articles/john/serversideprint/network.asp

If neither of those work, you could save the link for the page to a database and then have a Windows Service on the server that continually loops looking for pages it needs to print and have the Windows service handle the printing.
0
 
LVL 3

Author Comment

by:kolakanuru1
ID: 34927104
I went through the articles. They are not related my question.

I know how to print from my asp.net application if the printer is attached to the server hosting the application.

What I am looking for is to print a file from my asp.net application to a printer which is in network but  not installed on the server. I know printer URI. May be a binary dump of the file to the printer using its URI or some thing.

Besically, our organisation has lot of users. They have to print documents in printers close to them. It is not practical to install each and every printer on the server. The printers are attached to a print server and are given a URI.
0
 
LVL 3

Author Comment

by:kolakanuru1
ID: 34927702
One more thing is , since the printer is ipp printer, is there anyway that I can print using IPP from my asp.net
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 14

Accepted Solution

by:
quizwedge earned 500 total points
ID: 34930522
Sorry, I misunderstood. I thought that the printers were not installed on the users' machines, but they were on the server. I haven't worked with IPP before, but here's my best suggestion:

For the first half of the solution, have the ASP.NET app save a link to the page or the documents that you want to print along with URI for the printer.

For the second half, have a Windows service on the server that continually polls for documents to print. It can then add the printer on the fly using code from http://www.marcusnyberg.com/2010/11/17/how-to-install-a-network-printer-with-vb-net-and-wmi/

To prevent having tons of printers added to the server you could either search for the printer before adding it (modify the code at set the default printer at http://msdn.microsoft.com/en-us/library/aa394598(v=VS.85).aspx) or you could remove the printer after you've printed. I found some code for deleting (and actually adding as well) at http://binaryworld.net/Main/CodeDetail.aspx?CodeId=3646 but it only seems to be coming up in the Google Cache. The information talks about Windows 95 and Windows NT so it might be dated and no longer work. I also found information on deleting the printer at http://www.vbforums.com/showthread.php?t=331445&highlight=remove+printer The person had an issue with their code, but was able to resolve it. Unfortunately, they didn't post what their solution was other than a vague description.

Hope that helps... I'm not sure if you can print directly from ASP.NET without installing a printer and I'm also not sure if you can install a printer from ASP.NET. Even if you could, I'd worry about timeouts or the user leaving the page.

Hope that helps. Let me know if I can be of any other assistance.
0
 
LVL 3

Author Comment

by:kolakanuru1
ID: 34963920
quizwedge,
I would like installing printers on the server as the last option. How ever, thank you for your insights, they certainly opened up different avenues. Appreciate your suggestions.
0
 
LVL 3

Author Closing Comment

by:kolakanuru1
ID: 34963938
This is not a solution to my question.But, the comments by the expert are useful.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now