Printer print queue

Source: Internet
Author: User
  1. Printerserver: Manage the print queue on the print server.
     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: Manage printers and print jobs
  3. Printsystemjobinfo: detailed definition of the print job
  4. Printjobstatus: Specifies the current status of the job in the print queue.
  5. Printqueuestatus: Specifies the status of the print queue or its printer.
  6. Printqueue. queuestatus: gets the value used to indicate the printer status. These statuses include "pushing", "Initializing", and "printing.

 

 

Example:

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 {1 6 _ printqueue = PQ; 17} 18} 19} 20 21 public bool isprinted22 {23 get24 {25 return checkisprinted (_ printqueue ); 26} 27} 28 29 /// <summary> 30 // check whether the print queue is printed. 31 /// </Summary> 32 /// <Param name = "PQ "> print queue </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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.