Hello all!
I have some code below. I’m trying to read the status of the print queue on my server. I seem to be reading the PrintServer properties just fine, but the printer properties never change no matter what I do to the printer. I’m working if I’m using the wrong queue name or something. I have refresh methods being called and I have this running with a timer so it gets checked frequently. Has anyone used the PrinterServer and PrintQueue objects before? Any suggestions on why I can’t read the queue properties?
Thanks!
try
{
PrintServer ps = new PrintServer(@"\\\\DDP7805U");
ps.Refresh();
PrintQueue pq = new PrintQueue(ps, "Zebra");
pq.Refresh();
txtOutput.Text = "";
txtOutput.Text += "Hosting Print Server: " + pq.HostingPrintServer.Name.ToString() + Environment.NewLine;
txtOutput.Text += pq.Description.ToString() + Environment.NewLine;
txtOutput.Text += "Queue Name: " + pq.FullName + Environment.NewLine + Environment.NewLine;
txtOutput.Text += "Paper Problem?: " + pq.HasPaperProblem.ToString() + Environment.NewLine;
txtOutput.Text += "Need User Intervention: " + pq.NeedUserIntervention.ToString() + Environment.NewLine;
txtOutput.Text += "Is Busy: " + pq.IsBusy.ToString() + Environment.NewLine;
txtOutput.Text += "Is In Error: " + pq.IsInError.ToString() + Environment.NewLine;
txtOutput.Text += "Is Not Available: " + pq.IsNotAvailable.ToString() + Environment.NewLine;
txtOutput.Text += "Is Offline: " + pq.IsOffline.ToString() + Environment.NewLine;
txtOutput.Text += "Is Out of Memory: " + pq.IsOutOfMemory.ToString() + Environment.NewLine;
txtOutput.Text += "Is Out of Paper: " + pq.IsOutOfPaper.ToString() + Environment.NewLine;
txtOutput.Text += "Is Paper Jammed: " + pq.IsPaperJammed.ToString() + Environment.NewLine;
txtOutput.Text += "Status: " + pq.QueueStatus.ToString() + Environment.NewLine + Environment.NewLine;
txtOutput.Text += DateTime.Now.ToString();
}
catch(Exception ex)
{
txtOutput.Text = ex.ToString();
}