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开发者_JAVA百科 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.
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.
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.
精彩评论