Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

Get Printer Current Jobs using System.Management NameSpace in .NET 2.0 using C#.

Author: DevAsp Team
Download Source Code :

In this simple article you will learn how get Printer current Jobs.

Simply just create New Project of C#.


Drag two button, two labels, one textboxe,one timer and one Listbox on the form.


Now write code on Form load event


private void Form1_Load(object sender, EventArgs e)


           this.Text = "DevAsp LAN Printer Job Checker";

            label1.Text = "Printer Jobs";

            label2.Text = "Printer Name";

            textBox1.Text = @"\\MachineName\PrinterName";



Write one functoins


public static System.Collections.ArrayList GetPrintJobsCollection(string printerName)


            System.Collections.ArrayList printJobCollection = new System.Collections.ArrayList();



                string PrinterJobs = "SELECT * FROM Win32_PrintJob";

                ManagementObjectSearcher FindPrintJobs =

                          new ManagementObjectSearcher(PrinterJobs);

                ManagementObjectCollection prntJobCollection = FindPrintJobs.Get();

                foreach (ManagementObject prntJob in prntJobCollection)


                    System.String jobName = prntJob.Properties["Name"].Value.ToString();

                    char[] JobSplit = new char[1];

                    JobSplit[0] = Convert.ToChar(",");

                    string prnterName = jobName.Split(JobSplit)[0];

                    string documentName = "Doucment Name->" + prntJob.Properties["Document"].Value.ToString() + "               Sender Name->" + prntJob.Properties["owner"].Value.ToString();

                    if (String.Compare(prnterName, printerName, true) == 0)






            catch (Exception ex)




            return printJobCollection;




Now write code on Button Click events


private void button1_Click(object sender, EventArgs e)





        private void button2_Click(object sender, EventArgs e)






Now write  code on Timer Tick event


private void timer1_Tick(object sender, EventArgs e)


            System.Collections.ArrayList printerjobslist;


            if (printerjobslist.Count > 0)




                foreach (string job in printerjobslist)












This is all code for getting Printer Jobs.


Article Comments
I want to get status of my printer which is in network on another machine.
i.e. online/offline/busy/idle/paper jam/paerout ..etc
I want to retrieve all the status of that printer and if it is ready then only i will give print command to print the document. This I have to implement in C#.Net
So if I can get the code for this then I will be nery thankful for you.

Posted on 7/28/2007 1:07:04 AM by Rahul Kadu

i want to no how to get printer part

Posted on 12/29/2007 2:10:51 PM by shonibare kareem adisa

should it be
string PrinterJobs = "SELECT * FROM Win32_PrintJob";
string PrinterJobs = "SELECT * FROM Win32_Printer";

Posted on 5/10/2010 2:31:12 AM by TAN THIAM HUAT

Add Article Comment:
Name :
Email Address :
Comments :
<< Delete and Copy Files from a Folder with respect to their Extension in .NET 2.0 using C#.

Disclaimer - Privacy
© 2002-2017