- Print
Bartender extends the printing functionality possible from Tulip apps.
Download the Bartender Unit Test from the Tulip Library.
Bartender by Seagull Scientific is an industry-leading printing client that is used extensively throughout the manufacturing world to act as an interface layer between ERP/MES solutions and an ever-expanding list of printers, network configuration, and more.
In short, Bartender handles the printer side of this equation, and exposes API endpoints that Tulip connector functions can hit to print documents, this document will walk through that integration.
Network Considerations
The Bartender client will generally be hosted on a server (or computer) on your facility's internet network. This generally isn't accessible from outside systems. Because Tulip is running in The Cloud, we need to expose your instance of bartender to The Cloud.
There are a few ways to approach this:
- An On-Prem Connector host can act as this tunnel into your network. The setup process for these connectors can be a little involved, and will probably require support from your IT team.
- A Tulip Edge Device connected to your network can act as this connector host in your network. This is by far the easiest way to establish this tunnel, and shouldn't require any IT help to get setup. The Edge MC can be had for $150.
- An SSH Tunnel can be established to expose your bartender instance. This is the most technical option, and will almost certainly require IT department help to establish. This sort of Tunnel doesn't come with any of the built-in security of a Tulip-built solution.
Additionally, we will be using the Print Portal offering from Bartender. This is accessible only in their "Automation" and "Enterprise" plans.
Setup
This procedure was created as part of the original investigation of integration with the bartender, the functions provided in the unit test application might differ slightly.
Bartender Label Configuration
Within Bartender I created an example label called Label Example.btw this document is available for download (attached at the bottom of this article). The important configuration is to insure each dynamic field on your label is tied to an input on your template form. In this case I also renamed those input fields so our keys when using the label in Tulip is more intuitive.
Finally, I made note of the IP address of my Bartender server.
When Bartender is configured, you should be able to access the Print Portal from any machine on the same network at:
http://[server ip]/bartender
I would highly recommend testing your form from within the Print Portal to insure your Bartender instance is configured correctly.
Tulip Configuration
Note: In this example, I will be using an Edge MC as my connector host.
- Connect your Edge MC to your network
- Click into the Connector configuration
- Set the "Running on" field to the Connector host of your Edge MC
- Set the Host to the IP of your Bartender Server
- Set the Port to "5160" as indicated by the Bartender Server
Connector Functions
Printing to Bartender requires five connector functions:
- Get a list of folders in your bartender instance. Select the folder you would like to print from.
- Get a list of printers, and select the printer you would like to print to.
- Get a list of files within your desired folder. Select the file you would like to print.
- Make a request to the printing endpoint, this will return a request id.
- Pass the printer, path to label, request id and
Printers, folders and documents (1,2, and 3 above) will not change if the Bartender configuration does not change. These can be statically set in your production apps.
Get Folders
Inputs: Note
Outputs: A list of folders in your Bartender Instance. Each folder has 3 attributes:
- Unique ID
- Name
- Path - If this folder is within other folders, this will be the path to this folder.
Get Printers
Inputs: Note
Outputs: A list of printers configured in your Bartender instance.
Get Folder Items
Inputs: The unique folder ID, from the Get Folders function.
Outputs: A list of each of the file names in that folder, and the absolute path to that folder.
Get RequestID
Inputs: The printer name, the absolute path to the file (folder path + file name) and the unique ID for the folder (from the Get Folders function)
Outputs: A text value, this response ID will be used when printing.
This function needs to be called every time a print is done. A unique print ID is needed for each print job.
Inputs: The printer name, the absolute path to the file (folder path + file name) and the unique ID for the folder (from the Get Folders function), The responseID (from Get RequestID), and any of the dynamic fields in the label
Outputs: A text value indicating if the print was successful.
The dynamic fields in this label need to match those in within the label configuration in Bartender. The example Print function is configured to work with the Label Example.btw file that is provided with the Library Unit Test.