C# not getting any status of printer. I am printing and want to know status of printer whether "PRINTER IS PRINTING" or "PRINTER OUT OF PAPER".
Here is my code :-
string filePath = "C:\\Users\\fouzan\\Desktop\\abc.txt";
PrintDocument pd = new PrintDocument();
Process p = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.UseShellExecute = true;
startInfo.FileName = filePath;
startInfo.Verb = "print";
startInfo.Arguments = @"/p /h \" + filePath + "\"\"" + pd.PrinterSettings.PrinterName + "\"";
p.StartInfo = startInfo;
MessageBox.Show(p.StartInfo.ToString());
p.Start();
MessageBox.Show(p.Start().ToString());
LocalPrintServer server = new LocalPrintServer();
PrintQueue printQueue = server.GetPrintQueue("Samsung ML-2160 Series");
//this outputs "NONE":-
MessageBox.Show(printQueue.QueueStatus.ToString());
I am getting "NONE" output how can I know if printer is printing or its "out of paper".
I have selected default printer "Samsung ML-2160 Series" from printer properties.