BarTenderIntegration Methods
Integrating the BarTender Printing and Design Functionality
with Your Custom Application
Supports the following BarTender software versions:
BarTender 2019
WHITEPAPER
Contents
Overview 3
Integrating with External Data 4
Importing Data into BarTender 4
Preferred Integration Methods 5
Using BarTender Integration Builder 5
Using the BarTender .NETSDK 6
Using BarTender XML (BTXML) Script 8
Legacy Integration Methods 9
ActiveX Automation 9
Command-Line Interface 10
Using Printer Code Templates 11
How Printer Code Templates Work 11
When to Use Printer Code Templates 11
Technical Challenges of Printer Code Templates 11
Related Documentation 13
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 and
various 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
an external 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 the
following:
l Delimited text files
l XML files
l Microsoft Access
l Microsoft Excel
l Microsoft SQLServer
l Oracle
l Firebird
l IBM DB2
l IBM Informix
l Microsoft Azure SQL
l MySQL
l MariaDB
l PostGRE SQL
l SAP IDocs
l OLE DB Connection
l 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:
l Oracle XML print requests
l IBM WebSphere Sensor Events print requests
l SAP AII XML
l 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 the
newest technologies to provide our customers with the best possible integration solutions. These
methods are fully supported by Seagull Scientific technical support and continue to be updated with
each new release.
Using 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-level
tasks, including the following:
l Start a print job automatically when trigger events occur, such as when an email message
arrives, a file is saved or a database is modified.
l Connect to and communicate with clients via TCP/IP, UDP or HTTP.
l Perform basic file operations, such as move, rename, delete or copy.
l Integrate directly with ERP systems by using the support for SAP, Oracle or IBM WebSphere
connectivity 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 a
separate integration for each event.)
You can also use Integration Builder to edit and test the integration files and deploy them to the
Integration 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 to
print a BarTender document. In the case of a file event, the data to be processed might be
gathered 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.
BarTenderIntegration Methods 5
The action that the Integration Service might process can be as simple as sending a print
command for a BarTender document to the Print Scheduler Service. However, many more (and
more 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:
l Jobs that are printed to a specific printer always come out of that printer in the order the
requests were received.
l When 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.
Using the 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 your
applications without having to write from scratch the most commonly-needed routines for
automated printing.
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 documentation that greatly
simplify the task of writing code to control BarTender.
The BarTender .NET SDK includes the following application programming interfaces (APIs).
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. This provides a
powerful solution for your label printing needs, so that you can do the following:
l Open and close BarTender documents
l Modify text or barcode objects
l Connect to external databases
BarTenderIntegration Methods 6
l Export templates to images
l Print documents
l Monitor print jobs
To use the Print Engine API, you must have the Automation or 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 and
send BTXML scripts to be processed by BarTender. By using the client, you no longer need to
create and run a task manager to submit automated tasks to BarTender. As long as the service
is running, you can easily create actions and then run them by using their .NET code together
with the standard "run and result" methodology.
To use the Print Scheduler API, you must have the Automation or Enterprise edition of BarTender
installed.
Print Server API
Use the Print Server API to manage large, complex print jobs. This API provides flexibility,
scalability, and task-based management for label printing. For example, to print a large number
of labels requires you to manage 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 is submit print tasks to a task queue for processing.
To use the Print Server API, you must have the Automation or Enterprise edition of BarTender
installed.
Librarian API
Use the Librarian API to access the functionality of Librarian, which is a revision control system
that is installed with the BarTender Suite. By using this API, you can do the following:
l Check BarTender documents in or out of the repository
l Revert to previous revisions of documents
l Get file information
l Define workflow states
To use the Librarian API, you must have the Enterprise edition of BarTender installed.
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:
l Connect to the BarTender System Database
l Search and retrieve application messages, print job information and security checks
BarTenderIntegration Methods 7
l Filter data in the BarTenderSystem Database
l Reprint documents
To use the System Database API, you must have the Automation or Enterprise edition of
BarTender installed.
Using 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, the
items 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 white paper describes.
Example
The 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>
<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 8
Legacy Integration Methods
The integration methods that are described in this section are no longer actively supported by
Seagull Scientific and were replaced with newer technologies. These methods should be used for
backwards compatibility only.
ActiveX Automation
ActiveX Automation, also known as Common Object Model (COM), is a Microsoft standard for
interaction 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
are available 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 these
functions and data values to do the following:
l Open and close BarTender
l Open BarTender documents
l Modify the objects in a BarTender document
l Supply data to be printed
l Start print jobs
To use ActiveX Automation, you must have the Automaton or Enterprise edition of BarTender
installed.
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 pre-written
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 of this
white paper.
When to Use ActiveX Automation
ActiveX Automation can be useful when you want to use a programming or scripting
environment, such as the following:
l Visual Basic, Visual Basic for Applications (VBA) and Visual Basic Script (VBScript)
l Visual C, Visual C++ and other versions of C for Windows
BarTenderIntegration Methods 9
l Java, Visual J++, Visual J#, JavaScript and JScript
l Any language for which there is an ActiveX scripting engine that runs in the Windows Script
Host, including PERL, Python and REXX
Although VB.NET and C# both support ActiveX Automation, it is much easier to use the
BarTender .NET SDK when you use these languages.
Command-Line Interface
Use the BarTender command-line interface to interact with a computer program by issuing
commands to the program in the form of successive lines of command text. The interface provides a
minimum set of capabilities for controlling BarTender so that you can run BarTender from within
other programs 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
BarTender installed.
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 don't need to control other aspects of
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
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 pure
printer language file. Certain delimiters are inserted in significant places in the file, such as at the
start 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 the
basic 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 and
then configure the SAP system to run the appropriate SAPscript report and merge in the
required data whenever an SAP transaction requires one or more labels.
l Portable 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 printer
code 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.
l XML-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 have
access to Windows computers on the network, you can embed a printer code template to
take advantage 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.
l Multiple printer models are not supported.
BarTenderIntegration Methods 11
l Changing graphics is not supported.
l Paragraph formatting is not supported.
l Variable font sizing options are not supported.
BarTenderIntegration Methods 12
Related Documentation
White Papers
l Integrating with BarTender Integration Builder
l Transitioning fromCommander to Integration Builder
l Exporting Printer Code Templates
l AdministrationConsole
To view and download white papers, visit:
https://www.bartendersoftware.com/resources/white-papers/
Manuals
l Getting Started with BarTender
https://support.seagullscientific.com/hc/categories/200267887
BarTender Help System
l Automating BarTender
l Reading Data from Databases
l Integration Builder
l Automation with BarTender XML Script
l Automation with ActiveX
l Supported Database Types
Other Resources
Please visit the BarTender website at https://www.bartendersoftware.com.
Version 2019-04-02 Copyright © 2019 Seagull Scientific, Inc.