Detect Printer License Exceeded Follow

Legacy Poster

Hello everybody,

We are using the Bartender.NET SDK to print labels.

Sometimes however, we exceed our printer license.


Can someone please tell us how to detect this?

So how can we detect something went wrong with the printer licenses while printing the label in .NET?


This is our current code:

using (Engine barEngine = new Engine(true))
barEngine.JobErrorOccurred += barEngine_JobErrorOccurred;
barEngine.JobMonitorErrorOccurred += barEngine_JobMonitorErrorOccurred;
LabelFormatDocument bartenderLabelFormat = barEngine.Documents.Open(@"label.btw",printer);
bartenderLabelFormat.JobErrorOccurred += barEngine_JobErrorOccurred;
bartenderLabelFormat.JobMonitorErrorOccurred += barEngine_JobMonitorErrorOccurred;

void barEngine_JobMonitorErrorOccurred(object sender, MonitorErrorEventArgs e)
System.Windows.Forms.MessageBox.Show("An error occured while printing labels!", "BarEngine_JobMonitorErrorOccurred", MessageBoxButtons.OK, MessageBoxIcon.Error);       
void barEngine_JobErrorOccurred(object sender, PrintJobEventArgs e)
System.Windows.Forms.MessageBox.Show("An error occured while printing labels!", "BarEngine_JobErrorOccurred", MessageBoxButtons.OK, MessageBoxIcon.Error);     


Please note that we register two Events (JobErrorOccured and JobMonitorErrorOccurred) and this on both the Engine and on the Document.

However, none of these events are triggered when the printer license is exceeded.


Please tell us how we can detect this problem so we can show a message to the user.


Thanks in advance!


Ian Cummings
Comment actions Permalink

What version and build of BarTender are you using?  Check this via the "Help>About" menu item.


I advise that you configure email alerts in BarTender and License Server ("Administer>Alert Setup" menu item) so that an admin can be notified the moment the printer license is exceeded.  Note that in recent versions of BarTender we implemented the, "exceeding printer license grace period" thus allowing you to continue printing, uninterrupted, no matter if the license is exceeded.


In BarTender the message for exceeding the license is #1401.  The below example from the BarTender Help system demonstrates how to capture BarTender messages:


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

      // Get engine's documents.
      Documents btFormatsList = btEngine.Documents;

      // Open a format.
      LabelFormatDocument btFormat = btFormatsList.Open(@"C:\Format1.btw");

      // Initialize the Messages list.
      Messages btMessages = null;

      // Print the format, receiving messages.
      btFormat.Print("Test Print", 6000, out btMessages);

      // Create a new custom message.
      Message btMessage = new Message("End of printjob", 777,
         MessageSeverity.Information, "Miscellaneous");

      // Add the custom message.

      // Display information on each message. 
      foreach (Message m in btMessages)
         Console.WriteLine("Category = " + m.Category);
         Console.WriteLine("ID = " + m.ID);
         Console.WriteLine("Severity = " + m.Severity);
         Console.WriteLine("Text = " + m.Text);
         Console.WriteLine(" ");

      // Perform cleanup.

      // Stop the BarTender print engine.

Please sign in to leave a comment.