Write My Paper Button

WhatsApp Widget

Printer Queue Management | My Assignment Tutor

Printer QueueManagementLecture 8Important Class on printing LocalPrintServer: Initialise a new instance ofLocalPrintServer classExample: LocalPrintServer localPrintServer = newLocalPrintServer(); PrintQueue: Initialise a new instance of Printqueue as asubclass of LocalPrintServerExample: PrintQueue defaultPrintQueue =LocalPrintServer.GetDefaultPrintQueue(); PrintSystemJobInfo: Initialise a new instance as a subclassof PrintQueue.Example: PrintSystemJobInfo myPrintJob =defaultPrintQueue.AddJob();LocalPrintServerPrintQueue{refresh()Purge()Numberofjobs()GetPrintJobInfoCollection()}PrintSystemJobInfo{ Addjob()}Important class for printing PrintDocument p = new PrintDocument(); p.PrintPage += delegate … Continue reading “Printer Queue Management | My Assignment Tutor”

Printer QueueManagementLecture 8Important Class on printing LocalPrintServer: Initialise a new instance ofLocalPrintServer classExample: LocalPrintServer localPrintServer = newLocalPrintServer(); PrintQueue: Initialise a new instance of Printqueue as asubclass of LocalPrintServerExample: PrintQueue defaultPrintQueue =LocalPrintServer.GetDefaultPrintQueue(); PrintSystemJobInfo: Initialise a new instance as a subclassof PrintQueue.Example: PrintSystemJobInfo myPrintJob =defaultPrintQueue.AddJob();LocalPrintServerPrintQueue{refresh()Purge()Numberofjobs()GetPrintJobInfoCollection()}PrintSystemJobInfo{ Addjob()}Important class for printing PrintDocument p = new PrintDocument(); p.PrintPage += delegate (object sender1, PrintPageEventArgs e1) { e1.Graphics.DrawString(data, new System.Drawing.Font(“Times New Roman”, 12), new SolidBrush(Color.Black), new RectangleF(0, 0,p.DefaultPageSettings.PrintableArea.Width, p.DefaultPageSettings.PrintableArea.Height)); }; p.Print(); }So we are going to built the followingfunctions in relation to QueueTo add jobs to the queue: enqueue()To remove jobs from the queue: dequeue()To check the next job in the queue: Job_list()To clear the queue: clear_all_jobs()To count the number of jobs in the queue:job_size()Void enqueuevoid enqueue (String data) { // Create an instance of PrintSystemJobInfo Example: PrintSystemJobInfo myPrintJob =defaultPrintQueue.AddJob(“Amjad”); //adding job // Create an instance of printDocument PrintDocument p = new PrintDocument(); p.PrintPage += delegate (object sender1,PrintPageEventArgs e1) { e1.Graphics.DrawString(data, newSystem.Drawing.Font(“Times New Roman”, 12), newSolidBrush(Color.Black), new RectangleF(0, 0,p.DefaultPageSettings.PrintableArea.Width,p.DefaultPageSettings.PrintableArea.Height)); }; p.Print() }try{p.Print();}catch (Exception ex){throw newException(“ExceptionOccured WhilePrinting”, ex);}Void dequeue() void dequeue() { if (defaultPrintQueue == null) return; defaultPrintQueue.Refresh(); var jobs = defaultPrintQueue.GetPrintJobInfoCollection(); foreach (var job in jobs) { job.Cancel(); break; } }Void Job_size() void job_size() { int numberOfJobs = 0; if (defaultPrintQueue != null) numberOfJobs = defaultPrintQueue.NumberOfJobs; Console.WriteLine(“The number of jobs on queue is {0}”, numberOfJobs); }Void job_list() void job_list() { if (defaultPrintQueue == null) return; defaultPrintQueue.Refresh(); var jobs = defaultPrintQueue.GetPrintJobInfoCollection(); Console.WriteLine(“The jobs in ” + localPrintServer.Name + “are as follows: “); foreach (var job in jobs) { Console.WriteLine(job.Name); } Console.WriteLine(“nPress Return to continue.”); Console.ReadLine(); }Void clear_all_jobs() void clear_job() { defaultPrintQueue.Purge(); }More Readings on printing https://www.c-sharpcorner.com/technologies/printing-in-csharp https://docs.microsoft.com/enus/dotnet/framework/winforms/advanced/how-to-print-in-windows-formsusing-print-preview https://andres.jaimes.net/71/printing-in-csharp-the-easy-way/

Don`t copy text!
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
???? Hi, how can I help?