PrintQueue

PrintQueueCollection printQueues = null;

var printServer = new PrintServer();
printQueues = printServer.GetPrintQueues(new[] { EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Connections });
PrintQueue printQueue = printQueues.FirstOrDefault(p => p.Name.ToUpperInvariant().Contains(PrintName.ToUpperInvariant()));
if (printQueue != null)
{
      try
      {
            var jobs = printQueue.GetPrintJobInfoCollection().Count(j => j.JobStatus != PrintJobStatus.Completed);
            if (jobs == 0)
            {
          //print done
break; } } catch {
      //sometimes will happen } }

 

posted @ 2015-01-23 14:59  Yu  阅读(971)  评论(0编辑  收藏  举报