C# how do i printer status
Jordan Halgunseth
1
Reputation point
How do I get print status.
I would like to if it is offline before print.
This code works after error.
string printerinUse = pDialog.PrinterSettings.PrinterName;
var server = new LocalPrintServer();
PrintQueue queue = server.GetPrintQueue(printerinUse);
MessageBox.Show("printer " + printerinUse +" is " + queue.IsOffline.ToString());
//various properties of printQueue
bool isOutOfPaper = queue.IsOutOfPaper;
bool isOffLine = queue.IsOffline;
bool isPaperJam = queue.IsPaperJammed;
bool isNotResponding = queue.IsInError;
MessageBox.Show("printer " + printerinUse + " is " + isNotResponding.ToString());
if (isOffLine)
{
MessageBox.Show("Printer is offline");
return;
}
if (isOutOfPaper)
{
MessageBox.Show("Printer is out of paper");
return;
}
if (isPaperJam)
{
MessageBox.Show("Printer has a paper jam");
return;
}
if (isNotResponding)
{
MessageBox.Show("Printer is in error");
return;
}
Sign in to answer