I am working on an ASP.NET application and need to send documents to a network printer. I have utilized the PrintServer and PrintQueue to achieve the purpose as follows:
using System.Printing;
private void PrintTicket
{
var server = "Network Server Name";
var filePath = "File to Print";
var printer = "Network Printer Name";
var printerServer = new PrintServer(String.Format(@"\\{0}", server));
var printQueue = printerServer.GetPrintQueue(printer);
printQueue.AddJob("New Printing Job", filePath, false);
}
The network printer can be found and the print job is executed.
However, the performance is very slow. It took 5-10 seconds to start printing when method printQueue.AddJob() is executed.If the printer is connected to my local machine, there is no performance issue at all.
Any suggestions? Thanks in advance.