Curious On Grouptask S’abonner

0
Avatar
Legacy Poster

Hello everyone,

 

I've got an issue with printing of multiple copies of multi-label "tags" (I'll explain what I mean by this). I use the GroupTask object to ensure the pages print out in the correct order, but sometimes they do not... and I need some help!

 

Some background on the service I've written;

a) It is a WCF web service with many methods. The particular method with the issue is called PrintTag and it accepts many parameters including 'numberOfCopies' which allows the client to print the same "tag" multiple time (yes, it's safe-guarded to a maximum of 3 so no rogue element decides to use up all the print roll!)

 

b) It is using the BarTender Print Server .NET SDK. The version of BarTender in use is Enterprise Automation 10.1 SR2.

 

c) I've wrapped the BarTender TaskManager with a singleton for programming ease; the constructor will start a pre-defined number of Task Engines (5) and I've tied up every event handler for loging purposes. The singleton only offers one public method - QueueTask - which accepts the Task and calls the BarTender TaskManager.TaskQueue.QueueTask method which places the given Task on the BarTender print queue.

 

d) A "tag" actually is composed of one or more BarTender documents depending on the number of line items that need to be printed; For example, if there are 10 items per page and the service is asked to print 15 items, then on the first page the document PrintTag1.btw will be used and it will show the first 10 line items (so it is Page 1 of 2), and then the rest of the line items (5 line items) will be printed on PrintTagX.btw (so this is Page 2 of 2). If there are only 5 line items, then only  PrintTag1.btw will be used (page 1 of 1). If there are 25 line items, then PrintTag1.btw will be used for the first 10, and two PrintTagX.btw LabelFormat instances will be used. I hope you get the drift...

 

e) The code is written so that a GroupTask is created for each requested copy. The GroupTask contains PrintTag1.btw and PrintTagX.btw (none, one or many) PrintLabelFormatTasks in the page order that is needed to be printed. Continuing with the example of 15 line items, the GroupTask instance will contain two PrintLabelFormatTask object instances; the first being a LabelFormat instance of PrintTag1.btw, and the second being a LabelFormat instance of PrintTagX.btw. Here's the c# code for this...

 

        private void PrintGroupTask(List<LabelFormat> labelFormats, int numberOfCopies)
        {
 
            for (int i = 0; i < numberOfCopies; i++)
            {
                GroupTask groupTask = new GroupTask();
                foreach (LabelFormat labelFormat in labelFormats)
                {
                    PrintLabelFormatTask printTask = new PrintLabelFormatTask(labelFormat);
                    printTask.Name = String.Format("Page{0}", (groupTask.Count + 1).ToString("D10"));
                    groupTask.Add(new PrintLabelFormatTask(labelFormat));
                }
                // the PrintManager singleton
                PrintManager.Instance.QueueTask(groupTask);
            }
        }
 
 
 
The issue I am encountering is when a client calls the WCF service and requests for two copies to be printed to the same printer, the pages often don't come out in the correct order. For example, if two copies are requested of a two page "tag", then what comes out are pages 1,1,2,2 instead of pages 1,2,1,2.
 
When two clients call the web service simultaneously, the print order is definitely incorrect.
 
I have modified the “print spooled document first” option under the Advanced tab of the printer’s Properties dialog by enabling and disabling the option but with no success.
 
I am suspecting that each single page is being sent to the printer as a separate job rather than the whole GroupTask being sent as a single job.
 
Has anyone used GroupTask?  Could anyone shed some light on this? Maybe a different approach is needed?
 
Any help greatly appreciated.
 
John
 
 
 

 

9 commentaires

0
Avatar
Domingo Rodriguez
Modérateur
Actions pour les commentaires Permalien

John,

 

  1. Please attach the BarTender document (.btw) in question for us to examine.
  2. When you say 2 copies are requested for the 2 page tag, do you mean that 2 separate print requests (print jobs) are requested?
  3. What happens if you pause the printer's print queue and just send 1 copy for the 2 page tag? Do you just see one print job in the print queue?
  4. To which printer make and model are you printing to? Which printer driver (and version) have you installed for this printer? Do you see this behaviour as well when printing to a different printer?
  5. Will the behaviour be any different if the number of engines is set to 1 rather than 5? Print job order isn't guaranteed when more than one BT task is running simultaneously.
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Hi Domingo,

 

1. Please attach the BarTender document (.btw) in question for us to examine.
I will need to confirm with my client about posting the BarTender documents on the forum. Alternatively, if I receive permission, may I email them to you directly (or via a support email address)?
 
2. When you say 2 copies are requested for the 2 page tag, do you mean that 2 separate print requests (print jobs) are requested? 
The two LabelFormats are placed into a GroupTask instance, and then the GroupTask is added to the print queue (Print Server SDK function). What is the best way to verify the number of print requests?
FYI: My client has raised a support request with the Asia Pacific technical support who have briefly investigated and have stated that the code is "sending each single page as a separate job". Isn't that defeating the purpose and intention of the GroupTask object? The documentation states a GroupTask is processed in order ("Represents a Task that contains one or more Tasks that are run in order on a single TaskEngine"), and there might be a bug in the implementation of GroupTask by the Print Server .NET SDK.
 
3. What happens if you pause the printer's print queue and just send 1 copy for the 2 page tag? Do you just see one print job in the print queue?
I will try and let you know.
 
4. To which printer make and model are you printing to? Which printer driver (and version) have you installed for this printer? Do you see this behaviour as well when printing to a different printer?
We are printing to a Zebra ZT-230, and using the Seagull Scientific Zebra ZPL-II Driver Version: 7.3.3, Build Target:    x64, Build Date:5/2/2013 6:49 PM. 
I will try to print to another printer of the same make and model, but, as the print document is formatted to fit a specifically size paper roll, it is difficult to a select different printer type.
 
5. Will the behaviour be any different if the number of engines is set to 1 rather than 5? Print job order isn't guaranteed when more than one BT task is running simultaneously.
I suspect it will be different, especially if only one print job is sent per GroupTask instance. However, the volume of printing is expected to reach 3.5 million "tags" per annum, and thus the need for multiple Task Engines from the very beginning. While it is just a simple configuration change to only start one Task Engine rather than five, I am hesitant that one Task Engine may not be enough to handle the expected volume. I will ask the client to confirm the expected prints as prints per minute, given the range of operating days and hours across the company.
0
Avatar
Domingo Rodriguez
Modérateur
Actions pour les commentaires Permalien

I think that the most interesting information to find out is the "What happens if you pause the printer's print queue and just send 1 copy for the 2 page tag? Do you just see one print job in the print queue?" part.

 

Once I know this, I might be able to know as well if a "2 copies for the 2 page tag" request might end up with the pages being intercalated. 

 

If your customer is also based in Australia, contacting our Asian office for tech-support is the correct way to go. Our Asian office has direct access to our development team, and if necessary, will contact them for their input.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I did a quick test and sent 1 copy of a 2 page tag to the paused printer, and found that two jobs are shown in the print queue (as seen in Printer Maestro).

 

Printer Maestro is also showing each job as 0 pages. Hhhmmm...

0
Avatar
Domingo Rodriguez
Modérateur
Actions pour les commentaires Permalien

John,

 

It would be good to take a look at the BarTender .btw document (the one containing the 2 page "tag"). Either attach it to this forum topic, or send it to the corresponding tech-support office.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Domingo,

 

It is actually two BarTender .btw documents - each being one page - that are "joined" in a GroupTask to make the two page "tag"....

0
Avatar
Domingo Rodriguez
Modérateur
Actions pour les commentaires Permalien

When using the task manager and several BT processes are running, when sending different print jobs to the same printer, it might occur that the print job order is random. This is true if one bartend.exe print task takes longer than another. In order to make it a strict FIFO queue you could consider the following:

 

  • Just starting 1 BT process (might not be the ideal solution for you).
  • Set a task priority by using the Task.Priority property.
  • Implement your own task manager. We've other customers doing this because of the same reason (print job order might be random).
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Thanks Domingo.

 

I've suggested the third approach in resolving the issue to the client, and they have agreed.

 

As Seagull have discovered that you've several customers already doing this, can I suggest that you provide the solution in your future release ...

0
Avatar
Domingo Rodriguez
Modérateur
Actions pour les commentaires Permalien

Hello John,

 

Yes, we're aware of this and it is a "feature request" item. At this point we cannot guarantee you if and when this will be implemented, but I can guarantee you that our developers are aware that several customers would like the behaviour of the task manager with multiple running BT engines to be changed.

Vous devez vous connecter pour laisser un commentaire.