Printer Print Queue

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   ar   for   art   

  1. PrinterServer:在列印伺服器上管理列印佇列。
     1 // Create a PrintServer 2 // "theServer" must be a print server to which the user has full print access. 3 PrintServer myPrintServer = new PrintServer(@"\\theServer"); 4  5 // List the print server‘s queues 6 PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues(); 7 String printQueueNames = "My Print Queues:\n\n"; 8 foreach (PrintQueue pq in myPrintQueues) 9 {10     printQueueNames += "\t" + pq.Name + "\n";11 }12 Console.WriteLine(printQueueNames);13 Console.WriteLine("\nPress Return to continue.");14 Console.ReadLine();
    View Code
  2. PrintQueue:管理印表機與列印工作
  3. PrintSystemJobInfo:詳細定義列印工作
  4. PrintJobStatus:指定列印佇列中列印工作的目前狀態。
  5. PrintQueueStatus:指定列印佇列或其印表機的狀態。
  6. PrintQueue.QueueStatus:擷取用於表示印表機狀態的值。 這些狀態包括“正在預熱”、“正在初始化”、“正在列印”等。

 

 

     樣本:

 1   public class SystemPrintQueue 2     { 3         private string _printerName; 4         private string _owner; 5         private PrintQueue _printQueue; 6  7         public SystemPrintQueue(string printerName) 8         { 9             _printerName = printerName;10             _owner = System.Environment.UserName;11             PrintServer server = new PrintServer(printerName);12             foreach (PrintQueue pq in server.GetPrintQueues())13             {14                 if (pq.FullName.Equals(printerName))15                 {16                     _printQueue = pq;17                 }18             }19         }20 21         public bool IsPrinted22         {23             get24             {25                 return CheckIsPrinted(_printQueue);26             }27         }28 29         /// <summary>30         /// 檢測列印佇列是否列印完成31         /// </summary>32         /// <param name="pq">列印佇列</param>33         /// <returns></returns>34         private bool CheckIsPrinted(PrintQueue pq)35         {36             bool isPrinted = false;37             if (pq != null)38             {39                 pq.Refresh();40                 PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();41                 if (jobs != null && jobs.Count() > 0)42                 {43                     isPrinted = jobs.All<PrintSystemJobInfo>(job => job.Submitter == System.Environment.UserName && (job.JobStatus & PrintJobStatus.Paused) == PrintJobStatus.Paused);44                 }45                 else46                 {47                     isPrinted = true;48                 }49             }50             return isPrinted;51         }52     }

 

Printer Print Queue

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.