Automatically Delete Print Job If Printer In Error Follow



I am using BarTender for a particular application where the printed label must match what is on a pallet.  If for some reason, there is a problem with the printer, and the printer is in error, I want that print job to be deleted automatically.  The reason being is that each pallet has a unique identifier on it that is determined by another system (and that identifier is on the label). 


The problem is that if the printer runs out of labels, it will queue up the print jobs and start them again once you refill the labels.  This will cause the wrong label to go on the pallets.  That is a huge problem for us.  We would rather not have a label on the pallet.


So, does anyone know if there is a way to either not attempt to print the label, or just delete the print job when the printer is in error?


Any suggestions, thoughts?




Ian Cummings
Comment actions Permalink

Referring to the BarTender Help system you can make use of the Printer() class to check the PrinterStatusChanged event.  Your application could keep an updated log of each printer, so as not to direct a print job to a printer that does not have a ready status.  You'll need to make sure status monitoring is enabled in the driver, and that Printer Maestro is running on all necessary print servers.


Avoid checking the status of a given printer at time of printing to it, as this will affect performance.


public void Demo()
   // Initialize a new BarTender print engine. 
   using (Engine btEngine = new Engine())
      // Start the BarTender print engine.

      // Get the list of printers.
      Printers btPrintersList = new Printers();

      // Connect PrinterStatusChanged event.
      btPrintersList.Default.PrinterStatusChanged +=
         new EventHandler<PrinterEventArgs>(PrinterMonitor_PrinterStatusChanged);

      // Give the user time to change the printer status.
      Console.WriteLine("Press Enter to Continue...");

      // Stop the BarTender print engine.

Note sure how to delete a print job in the print queue without searching the internet, there is probably a Windows/.NET API to do this somewhere.

Legacy Poster
Comment actions Permalink

Thank you!  I will give this a try.

I did try searching to see if something existed to delete a print job in the queue, but didn't find an awful lot.  Will try again with different search criteria.



Please sign in to leave a comment.