Printer Name Ignored When Using Task Manager 追蹤

Legacy Poster


I need some advices on how to get Bartender to send job to the correct printer via Task Manager.

Bartender is printing to Window's default printer when using TaskManager.TaskQueue.QueueTask.
LabelFormat.PrintSetup.PrinterName works when using the Engine alone and getting the Engine
to print but it look as though this setting is ignored when using Task Manager.

Basically what I did:

1. Create and start Task Manager
2. Create and start Engine (so that I can set the SubStrings)
3. Load the LabelFormat using Engine.Documents.Open
4. Set the printer using LabelFormat.PrintSetup.PrinterName
5. Set the number of copies
6. Set the SubStrings
7. Add to queue via TaskManager.TaskQueue.QueueTask

It printed fine except where I set the printer's name to 'XXX' and Window's default is 'YYY'
Bartender would print to 'YYY'

2 意見

Legacy Poster
評論操作 永久連結


Domingo Rodriguez
評論操作 永久連結

The following example shows how to use GetLabelFormatTask to retrieve label format information. If you use this task for showing the Printer Name to be used after you've changed the printer selection for the BT document, does it show the Default printer or the correct one? Do you perhaps just have to save the BarTender document once the changes in the printer selection have been done?


public void Demo()
   // Initialize a new TaskManager object. 
   using (TaskManager btTaskManager = new TaskManager())
      // Start a task engine.

      // Create a new task to retrieve format information.
      GetLabelFormatTask task = new GetLabelFormatTask(@"C:\Format1.btw");

      // Execute the task and wait for completion.
      TaskStatus status = btTaskManager.TaskQueue.QueueTaskAndWait(task, 60000);

      if (status == TaskStatus.Success)
         // Get the LabelFormat object from the task // (this is cached format information; not an open document).
         LabelFormat format = task.LabelFormat;

         // Display some general information about the label format.
         Console.WriteLine("Label Format Name: '{0}'", format.BaseName);
         Console.WriteLine("Printer Name:      '{0}'", format.PrintSetup.PrinterName);
         Console.WriteLine("Named Substrings:   {0}\n", format.SubStrings.Count);

         // Display the names and values of any named substrings in the format. foreach (SubString s in format.SubStrings)
            Console.WriteLine("Substring Name: '{0}' Value: '{1}'", s.Name, s.Value);

      // Stop any running task engines.
      btTaskManager.Stop(5000, true);