.NET
Microsoft Technologies based on the .NET software framework.
897 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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;
}
The first time throw if there is no paper. The printdialog ssends document to printer.
After documengt is sent error in printer.
Then the code works but you have to print twice.
I want it to tell it is out of paper before document is first time.
@Jordan Halgunseth , thanks for the feedback, do you use the code to print the document? If so, please tell me about it. I will check if it is related to the code to print document.
code for printing document.
Sign in to comment