2

I have been looking for tools which will allow to send documents (pdf,txt,doc,etc) to network printer.

I am aware of the PrintDocument, Graphics to print text to Printer. what I am looking for is easy and less noise solution to achieve it

i.e.

using(printer p = new XPrinter)
{
  p.filename = "C:\\1.txt";
  p.printername ="\\network1\mainprinter";
  p.print();
}

Are there any open source or 3rd party tools available to ease printing in dotnet 4.. winform/wpf. or any ideas to achieve it.

EDIT Ideally I want to install this printing application on server and then complete print requests on network printer as requested.

swapneel
  • 3,061
  • 1
  • 25
  • 32

2 Answers2

2

Formatting complex document types like .pdf and .doc for a printer is not something you'd want to get into. You'll need gobs of software to even read the file, let alone format it. And it is invariably pointless, the user will already have the native application that handles the file format installed on her machine. Microsoft Office, Adobe Reader, etc.

There's a standard protocol in Windows to get files printed. You use the Process and ProcessStartInfo classes. Set the filename to the path of the file, the Verb to "Print". Process.Start() that, the native app will print the document. Same thing you get when you right-click the file in Explorer and click Print.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Process.start will not allow me to change printer settings. is it? Can IPP be used here instead of standard windows protocol... i am not sure how to progres sthis further – swapneel Jan 23 '11 at 18:14
  • It is up to the app to change printer settings, it is doing the printing. No idea what IPP might mean. If you mean IPC then, no. – Hans Passant Jan 23 '11 at 18:30
  • internet printing protocol. do you have a example to change printer settings using process. – swapneel Jan 23 '11 at 20:35
  • 1
    People print documents across the Internet? Isn't it kind of a long walk to pick up the paper? First I heard of it. From what I see in the TechNet docs it is purely HTML based. – Hans Passant Jan 23 '11 at 20:48
  • I want server Service to print on user's machine. so i want to chnage printer name for every user – swapneel Jan 24 '11 at 08:47
0

According to other posts, it seems like http://itextpdf.com/ seems to be a good option. I have not used it so I would not if it is good or not. HTH.

gbvb
  • 866
  • 5
  • 10