I used following code to print a pdf :
var fileName = filepath;
ProcessStartInfo psInfo = new ProcessStartInfo();
psInfo.Arguments = ConfigurationManager.AppSettings["printer_name"];
psInfo.FileName = fileName;
psInfo.WindowStyle = ProcessWindowStyle.Hidden;
psInfo.Verb = "print";
psInfo.CreateNoWindow = false;
psInfo.UseShellExecute = true;
process = Process.Start(psInfo);
following to get status of printer :
string query = string.Format("SELECT * from Win32_Printer "+ "WHERE Name LIKE '% {0}'",printerName);
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection coll = searcher.Get();
foreach (ManagementObject printer in coll)
{
foreach (PropertyData property in printer.Properties)
{
Logger.LogInfo(""+property.Name, "" +property.Value);
}
}
and also tried following to monitor Print queue :
LocalPrintServer server = new LocalPrintServer();
PrintQueueCollection queueCollection = server.GetPrintQueues();
PrintQueue printQueue = null;
foreach (PrintQueue pq in queueCollection)
{
if (pq.FullName == "HP LaserJet P1505n")
printQueue = pq;
}
int numberOfJobs = 0;
if (printQueue != null)
numberOfJobs = printQueue.NumberOfJobs;
All i want to do is to know is wether the document i did print using (1) is printed succesfully or not!! (2)nd code Snippet just shows same property anme and values always.So cannot notify print status.(3)rd code Snippet always monitors queue once and says '0' numberofjobs.
So what is the actual way to getback the print status?