Configuring Bartender As A Web Service Using Print Server Sdk 追蹤

Legacy Poster



I am trying to set up bartender as a web service to handle high volume print requests. My current architecture works as follows:

  A user's application accesses our web service and provides parameters for a print job.

  The web service opens bartender, performs the print job, and closes bartender.

  The web service returns an XML string which is parsed and returned to the calling application.


This approach works well for a limited number of requests, but our server cannot handle a large number of concurrent requests.


I would like help coming up with a solution to this.


This all was done using the Bartender Print SDK. The Bartender Print Server SDK is supposed to help with handling high volume requests, but I am unable to configure this at the moment. 


Thanks in advance for the help!

4 意見

Ian Cummings
評論操作 永久連結

Don't kill a BarTender process for each print request, instead keep them alive and reuse for subsequent print jobs.  This is what the PrintServer SDK does, and it also allows you to scale up the number of processes running in parallel to thus print multiple print jobs in parallel.  Take a look at the Web Print Server SDK example to see how it's done.

Legacy Poster
評論操作 永久連結

Thank you for the response.


Were you referring to the Print Server SDK and the WebLabelPrint example?


I am trying to convert some of my old code into a format compatible with the print server SDK.


What I used to have was: 


Dim myformat As LabelFormatDocument
Dim myEngine As New Engine()

myformat = myEngine.Documents.Open(sPrintFileLocation)
myformat.PrintSetup.PrinterName = sPrinterName
myformat.PrintSetup.IdenticalCopiesOfLabel = nNumberofLabels

'set data
For i As Integer = 0 To aData.GetUpperBound(0)
  myformat.SubStrings(i).Value = aData(i)

Dim myMessages As Messages
Dim waitForCompletionTimeout As Integer = 10000
Dim myResult As Result = myformat.Print("Barcode Printing", waitForCompletionTimeout, myMessages)

What I am doing here is configuring the label I would like to print and the location I would like to to print too before I actually do the printing. Can you provide assistance in helping me get there?

Domingo Rodriguez
評論操作 永久連結

BarTender's Help (F1 key within BarTender) has plenty of information on how to perform task based printing using the Print Server SDK and on how to manage print load. I suggest you to take a look at the "Automating BarTender > Automation with the BarTender .NET SDK > BarTender .NET Print Server SDK > Getting Started topic".


Yes the Web Label Print Sample source code can be found under "C:\Program Files (x86)\Seagull\BarTender Suite\SDK\Print Server SDK Samples\WebLabelPrint".

Gene Henson
評論操作 永久連結

Just to give you a high level understanding of the Print Server SDK, there are a few concepts that you should understand:

  • Print Engine(s) - this is the BarTender process, or processes, that will do that actual printing
  • Task - this is something you want to do, which is most often a print job
  • Task Queue - this is our logic that sits between the two

You'll end up creating "tasks" that contain the configured print job information (similar to what you're doing above, setting the printer, label format, copies, etc.), and then you'll submit that task to the task queue.  Any available print engines will go to the task queue and consume the submitted tasks.


This is much more efficient for high frequency printing because, as Ian mentioned above, you can spin up multiple print engines that sit and wait for available work.  All you have to do is create and submit your tasks, and everything is handled by the SDK.  You can even write some logic to start more engines during peak printing, etc.


As Domingo said, the BarTender SDK help has a wealth of information on this topic including code samples.