Windows Forms application, printing is done by creating process with command. I want to get error messages when printing fails, is this possible?
ProcessStartInfo info = new ProcessStartInfo(filePath)
{
Arguments = "\"" + printerName + "\"",
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = true,
Verb = "PrintTo"
};
Process.Start(info);
Tried to use System.Printing.PrintSystemJobInfo
to determine print outcome, but is not possible to determine from it, since it never get status IsCompleted
. And print job disappears quickly.
Also tried to change print process to:
var printQueue = FindPrintQueue(printerName);
printQueue.Refresh();
PrintSystemJobInfo job = printQueue.AddJob(filePath, filePath, false);
But in this case printing job is created but the printing has the status "Spooling" and document is not printed at all.