Technical Document
EnglishBarTender Integration Methods
INTEGRATING THE BARTENDER® PRINTING AND DESIGNFUNCTIONALITY WITH YOUR CUSTOM APPLICATIONSUPPORTS: BARTENDER® 2022 AND LATER VERSIONSContents
Overview
Integrating with External Data
Importing Data into BarTender
Preferred Integration Methods
BarTender REST API
BarTender Integration Builder
Integration Builder
Administration Console
BarTender Integration Service
BarTender Print Scheduler Service
BarTender .NET SDK
Librarian API
Print Scheduler API
System Database API
Print Engine API
Print Server API
BarTender XML (BTXML) Script
ExampleLegacy Integration Methods
Print Engine API
Print Server API
Command-Line Interface
When to Use the Command-Line Interface
ActiveX Automation
When to Use ActiveX Automation
Using Printer Code Templates
How Printer Code Templates Work

3
4
4
5
5
5
5
6
6
6
6
7
7
7
8
8
8
8
10
10
10
10
10
11
11
13
13

When to Use Printer Code TemplatesTechnical Challenges of Printer Code Templates
Related Documentation

13
13
15

Overview
Enterprise-level printing is usually part of a larger process that involves additional software besides
BarTender. Typically, software applications for manufacturing, inventory, shipping, accounting andvarious other supply-chain management functions depend on multiple applications to work together
to make essential tracking and identification functions possible. For this reason, many systems
integrators and consultants integrate Oracle, SAP and other enterprise resource planning (ERP)
applications with label, barcode, RFID and card printing applications such as BarTender.
You can use the BarTender integration functionality to import data from external systems and allow
other applications to use BarTender to print your BarTender documents. In this kind of scenario,
BarTender functions as the print engine that sends documents to the printer.

BarTender Integration Methods

3Integrating with External Data
When you integrate BarTender with other software, you frequently connect to and import data from anexternal system. Depending on your printing environment, BarTender can connect directly to a
database or spreadsheet, or you can import transactional data from an external ERP system, such as
Oracle, SAP or IBM WebSphere.

Importing Data into BarTender
BarTender can read data from many popular database platforms. Integration with these platforms
requires no additional programming or custom processing. Supported database engines include thefollowing:l

Embedded data tablesl

IBM DB2l

Delimited text filesl

IBM Informixl

XML filesl

Google Sheetsl

BarTender Data Builder databaseslMicrosoft Azure SQLlMicrosoft Excel

l

MySQL

l

Excel OnlinelMariaDBl

Microsoft Accessl

PostGRE SQLlMicrosoft SQL ServerlQuickBooks OnlinelOraclel

SAP IDocs

l

JSON

l

OLE DB ConnectionlFirebirdl

ODBC Connection

For more information about supported database types, refer to Supported Database Types in the
BarTender help system.
Sometimes your external database is stored in a proprietary format (that is not supported by OLE DB
or ODBC) or is located somewhere on your network that BarTender cannot detect. In these cases, you
can either write a way to read and use the data in your custom application or use the built-in
transforms that Integration Builder provides to use predefined formats, including the following:lOracle XML print requestsl

IBM WebSphere Sensor Events print requestsl

SAP AII XMLl

SAPscript-generated fixed-width text files

BarTender Integration Methods

4Preferred Integration Methods
We recommend that you use the following integration methods. They were developed by using thenewest technologies to provide our customers with the best possible integration solutions. Thesemethods are fully supported by Seagull Scientific technical support and continue to be updated witheach new release.

BarTender REST API
Automation of BarTender by using the BarTender REST API shouldbe performed by programmers who are familiar with REST APIs.
The BarTender REST API provides REST endpoints that you can use to automate your system on a
non-Windows platform or across the network by using the YAML or JSON file format or an existing
legacy BTXML script. By using the BarTender REST API, you can use most types of programming
languages, including C#, Java, Perl, or Python, and most integrated development environments (IDEs)
to create your automation scripts.
BarTender provides complete documentation for the API endpoints together with examples of scripts
in YAML, JSON, and BTXML formats. You can view this documentation after you install BarTender byusing ReDoc, which is included in the BarTender installation file. The BarTender REST API uses thePOST, GET, and PATCH commands.
For more information, refer to Using the BarTender REST API in the BarTender help system.

BarTender Integration Builder
BarTender Integration Builder provides a native integration solution that combines two user
applications (Integration Builder and Administration Console) with two Windows-based services(BarTender Integration Service and BarTender Print Scheduler Service) to ensure that your printing
operation runs smoothly at all times. By using these components, you can perform enterprise-leveltasks, including the following:lStart a print job automatically when trigger events occur, such as when an email message
arrives, a file is saved or a database is modified.

lConnect to and communicate with clients via TCP/IP, UDP or HTTP.

l

Perform basic file operations, such as move, rename, delete or copy.

lIntegrate directly with ERP systems by using the support for SAP, Oracle or IBM WebSphereconnectivity that BarTender provides.

Integration Builder
Integration Builder makes it easy to create your own integration files. An integration file is a
proprietary XML document that defines one or more integrations. Each integration consists of a
trigger event and one or more actions. (To monitor for more than one trigger event, you create aseparate integration for each event.)

BarTender Integration Methods

5You can also use Integration Builder to edit and test the integration files and deploy them to theIntegration Service. After you deploy the integration file, the Integration Service begins to monitor
for the trigger events that you specified.

Administration Console
You can use the Integrations section of Administration Console to deploy and monitor
integrations that are running on a server. At any time, you can monitor the integration's logged
messages as the Integration Service detects the trigger event and runs its actions.
Use the Windows Services section of Administration Console to start and stop the BarTender
Integration Service and the BarTender Print Scheduler Service.

BarTender Integration Service
The BarTender Integration Service monitors for integration trigger events. When it detects a
trigger event, it runs actions in response, such as transforming data and then using that data toprint a BarTender document. In the case of a file event, the data to be processed might begathered from the file itself. In the case of a TCP/IP request or a serial port event, the data might
be gathered from what is sent over that connection.
The action that the Integration Service might process can be as simple as sending a printcommand for a BarTender document to the Print Scheduler Service. However, many more (andmore complex) actions are supported.
The Integration Service can host any number of integration files. You can deploy a new or updated
integration file without affecting other integrations that are already running.

BarTender Print Scheduler Service
The BarTender Print Scheduler Service manages BarTender print engines and intelligently assigns
jobs to them while maximizing performance and maintaining print order and any serialization. It
uses a single pool of print engines so that resources are used efficiently. The Print Scheduler
Service ensures the following:lJobs that are printed to a specific printer always come out of that printer in the order therequests were received.

lWhen documents contain embedded data that can change, such as serialized counters,
they are bound to a single print engine to ensure that they are printed in the correct order.

BarTender .NET SDK
The BarTender .NET software development kit (SDK) include libraries of pre-written and debugged
source code that controls BarTender behavior, such as loading BarTender documents and starting
print jobs. You can use either C# or VB.NET to seamlessly integrate BarTender functionality into yourapplications without having to write from scratch the most commonly-needed routines for automatedprinting.

BarTender Integration Methods6

If you are using a .NET programming language, such as C# or
VB.NET, we recommend that you use the BarTender .NET SDK
instead of the ActiveX Automation interface. The BarTender .NET
SDK can be faster and easier for .NET programmers to use, because
it includes pre-written source code and extensive documentationthat greatly simplify the task of writing code to control BarTender.
The BarTender .NET SDK includes the following application programming interfaces (APIs).

Librarian API
Use the Librarian API to access the functionality of Librarian, which is a revision control systemthat is installed with the BarTender Suite. By using this API, you can do the following:l

Check BarTender documents in or out of the repositoryl

Revert to previous revisions of documentsl

Get file informationlDefine workflow states

To use the Librarian API, you must have the Enterprise edition of BarTender installed.

Print Scheduler API
Use the Print Scheduler API to interact with the Print Scheduler Service and the BarTender
automation system. The client contains the actions that print, export, and query documents andsend BTXML scripts to be processed by BarTender. By using the client, you no longer need tocreate and run a task manager to submit automated tasks to BarTender. As long as the service isrunning, you can easily create actions and then run them by using their .NET code together withthe standard "run and result" methodology.
To use the Print Scheduler API, you must have the Automation or Enterprise edition of BarTenderinstalled.

System Database API
The System Database API provides access to information that is stored in the BarTender System
Database. By using this API, you can do the following:lConnect to the BarTender System Databasel

Search and retrieve application messages, print job information and security checkslFilter data in the BarTender System Databasel

Reprint documents

To use the System Database API, you must have the Automation or Enterprise edition of
BarTender installed.

BarTender Integration Methods

7Print Engine API

This API has been superseded by newer technologies and should be
used only for testing and backward compatibility.
This API provides a managed interoperability wrapper for the BarTender print engine. To use thePrint Engine API, you must have the Automation or Enterprise edition of BarTender installed.

Print Server API

This API has been superseded by newer technologies and should be
used only for testing and backward compatibility.
This API provides scalable, task-based management of large or complex print jobs. To use thePrint Server API, you must have the Automation or Enterprise edition of BarTender installed.

BarTender XML (BTXML) Script
BarTender XML (BTXML) script is a pre-written XML schema that is installed with BarTender. You can
use BTXML script to control BarTender and print jobs, and you can send BTXML script to your external
software applications to run BarTender and print jobs.
An XML response is created after the script is run. For example, when you use BTXML script to print a
document, you receive an XML response that gives you valuable information about the print job, theitems that were printed, the printer that was used to complete the job, and the BarTender settings
that were used during the print job. You can integrate this response with a custom application.
Most ERP software packages already have built-in standard functions for generating XML. This is one
reason why using XML is so convenient for instructing applications to send commands to BarTender.
One potential challenge, however, is that the default XML that is generated by this software may not
be compatible with the BTXML format that BarTender uses. As an alternative to generating custom
XML from your ERP application, you can generate your XML in its default format and then convert it to
BXTML by using Integration Builder.
After you write your BTXML script, you can run it by using any of the other integration methods that
this technical document describes.

ExampleThe following sample code opens the Document1.btw document and then sends a print job that
contains 100 serialized items to Tray 1 of the HP LaserJet printer.

<?xml version="1.0" encoding="utf-8"?><XMLScript Version="2.0"><Command>

BarTender Integration Methods

8

<Print JobName="Job1"><Format>c:\BarTender\Document1.btw</Format><PrintSetup><NumberSerializedLabels>100</NumberSerializedLabels><Printer>HP LaserJet</Printer><PaperTray>Tray 1</PaperTray></PrintSetup></Print></Command></XMLScript>

BarTender Integration Methods

9Legacy Integration Methods
The integration methods that are described in this section are superseded by newer technologies. We
recommend that you use these methods for backwards compatibility only.

Print Engine API
Developers can use the Print Engine API to manage the BarTender print engines, automate printing.
and quickly modify and print labels by using any .NET language. The Print Engine API uses managed.NET code to automate unmanaged BarTender functionality, which allows for superior resource
management and extensibility over the BarTender ActiveX (COM) API. By using this API, you can do thefollowing:lOpen and close BarTender documentslModify text or barcode objectslConnect to external databaseslExport templates to imageslPrint documentslMonitor print jobs

Print Server API
Use the Print Server API to manage large or complex print jobs. This API provides scalability and taskbased management for label printing. For example, to print a large number of labels requires you tomanage multiple BarTender print engines. By using the Print Server API, you can start as many print
engines as you need and add more engines as print demand increases. All that you need to do issubmit print tasks to a task queue for processing.

Command-Line Interface
Use the BarTender command-line interface to interact with a computer program by issuingcommands to the program in the form of successive lines of command text. The interface provides aminimum set of capabilities for controlling BarTender so that you can run BarTender from within otherprograms or change the BarTender start-up behavior.
The command-line interface is primarily suited for specifying which BarTender document and external
text file to use for a print job. It provides little additional control.
To use the command-line interface, you must have the Automation or Enterprise edition of BarTenderinstalled.

When to Use the Command-Line Interface
The command-line interface can be useful in the following situations:l

You need to specify a text file for a print job, and you do not need to control other aspectsof BarTender.

l

You need to create a shortcut on your computer to open an instance of BarTender that has
specific settings.

BarTender Integration Methods

10ActiveX Automation
ActiveX Automation, also known as Common Object Model (COM), is a Microsoft standard forinteraction among Windows programs. The support that BarTender provides for ActiveX Automation
makes it possible for developers to enhance their Windows applications with code that instructs
BarTender to automatically perform most of the data retrieval, data entry, and printing tasks that areavailable when BarTender is used as a stand-alone application.
Use the BarTender ActiveX Automation interface to control the BarTender server application by using
your own custom program. Programs that use ActiveX Automation do so by calling methods(functions) and reading and writing various properties (data values) in BarTender. You can use thesefunctions and data values to do the following:lOpen and close BarTenderlOpen BarTender documentslModify the objects in a BarTender documentlSupply data to be printedlStart print jobs

To use ActiveX Automation, you must have the Automation or Enterprise edition of BarTenderinstalled.

If you are using a .NET programming language, such as C# or
VB.NET, we recommend that you use the BarTender .NET SDK
instead of the ActiveX Automation interface. The SDK gives you prewritten procedures that access and control the ActiveX Automation
functions for you. When you use the SDK, your programs still control
BarTender by using ActiveX at a low level, but you significantly reduce
the amount of programming and debugging that are required.
For more information, refer to the BarTender .NET SDK section ofthis technical document.

When to Use ActiveX Automation
ActiveX Automation can be useful when you want to use a programming or scripting environment,such as the following:lVisual Basic, Visual Basic for Applications (VBA) and Visual Basic Script (VBScript)lVisual C, Visual C++ and other versions of C for WindowslJava, Visual J++, Visual J#, JavaScript and JScriptl

Any language for which there is an ActiveX scripting engine that runs in the Windows Script
Host, including PERL, Python and REXX

BarTender Integration Methods

11

Although VB.NET and C# both support ActiveX Automation, it is much easier to use the BarTender.NET SDK when you use these languages.

BarTender Integration Methods

12Using Printer Code Templates
A printer code template is a file that is written mainly in the language of a printer, but it is not a pureprinter language file. Certain delimiters are inserted in significant places in the file, such as at thestart and end of each line, and placeholders are added that are replaced at print time by actual data.
Delimiters include headers, footers, start and end line delimiters, start and end print code delimiters,
and delimiters at the start and end of data fields.

How Printer Code Templates Work
Implementing and using printer code templates requires specialized technical knowledge, but thebasic process is straightforward, as follows:
1. Use BarTender to export your document to a printer code template.
2. Upload the printer code template to a hardware device or an external application.
3. Manually insert the data into your hardware device or import it from your external application.
4. Send the merged file to the printer.

When to Use Printer Code Templates
Printer code templates can be useful in the following situations:l

SAPscript-ITF Integrations: You can "upload" a printer code template to an SAP system andthen configure the SAP system to run the appropriate SAPscript report and merge in therequired data whenever an SAP transaction requires one or more labels.

lPortable Keypad Devices: Portable keypad devices include a portable keyboard, a small
screen display, and a printer port. You can use such devices to download and store printercode templates. The devices can then prompt you for the data, merge it with the printer code
template, and then output the printer code to the attached printer.

lXML-enabled Printers: Some thermal printers have an option to accept printer code templates.
After you download a printer code template to the printer, you can send data only (without
printer code) to the XML-enabled printer.

l

Non-Windows Environments: In situations where a controlling application may not haveaccess to Windows computers on the network, you can embed a printer code template to takeadvantage of the convenience of Windows-based label and barcode design (although not
Windows-based printing).

Technical Challenges of Printer Code Templates
To create printer code templates, the Automation or Enterprise edition of BarTender must be
installed. However, unlike in a conventional print job, when a printer code template is used,
BarTender does not serve as the print engine for the print jobs. Therefore, BarTender cannot provide
the variety of advanced printing features that Seagull Scientific has developed over many years.
Some of the technical and security challenges of printer code templates include the following:l

The user must have advanced printer coding knowledge.

lMultiple printer models are not supported.

BarTender Integration Methods

13lChanging graphics is not supported.

lParagraph formatting is not supported.

l

Variable font sizing options are not supported.

BarTender Integration Methods

14

Related Documentation
Technical DocumentslIntegrating with BarTender Integration BuilderlTransitioning from Commander to Integration BuilderlExporting Printer Code TemplateslAdministration Console

To view and download technical documents, visit:https://www.seagullscientific.com/resources/white-papers/

User GuideslGetting Started with BarTender
https://support.seagullscientific.com/hc/en-us/articles/9926265797143-Getting-Started-with-BarTenderSoftware

BarTender Help Systeml

Automating BarTenderlUsing the BarTender REST APIlIntegration BuilderlUsing BarTender XML ScriptlUsing ActiveXl

Reading Data from DatabaseslSupported Database Types

Other Resources
Please visit the BarTender website at https://www.seagullscientific.com.

© 2023 Seagull Scientific, LLC. BarTender, BarTender Cloud, Intelligent Templates, Drivers by
Seagull, the BarTender logo, the BarTender Cloud logo, and the Drivers by Seagull logo aretrademarks or registered trademarks of Seagull Scientific, LLC. All other trademarks are the propertyof their respective owners.

Version 1/10/2023 © 2023 Seagull Scientific, LLC