Technical Document
EnglishExporting Printer CodeTemplates
ADVANTAGES AND CHALLENGES OF USING PRINTER
CODE TEMPLATES WITH BARTENDER®
SUPPORTS: BARTENDER ® 2019 AND LATER VERSIONSContents
Overview
Print Systems
Printer Code Templates
Printing with Printer Code Templates
Embedded Printer Code
SAPscript-ITF Integrations
Portable Keypad Devices
XML-enabled Printers
Non-Windows Environments
Technical Challenges of Printer Code Templates
Required Coding Knowledge
Extensive Design Changes
Complicated Printer Maintenance
No Print Job Status Monitoring
No Support for Multiple Printer Models
No Support for Changing Graphics
No Paragraph Formatting
No Variable Font Sizes
Loss of Security and Audit Preparation Features
Loss of Advanced Print Management Functions
Adding Template Field Names
Exporting a Printer Code Template
Verification of Printer Code Templates
Customizing Print Systems
Search and Replace
Example of How to Use a Printer Code Template
Related Documentation

3
3
3
4
5
5
5
6
6
7
7
7
7
7
8
8
8
8
8
8
9
10
11
12
12
14
17

OverviewPrint Systems
In some manufacturing situations, portable devices or terminals are used to print items. These
portable devices and terminals typically merge user input information, such as lot number andexpiration date, into the printer code for a template and then send the completed printer code
directly to the printer.
Other systems might use software printing applications that merge user information into the printercode for an item. These applications might be running on a non-Windows computer.
Taken collectively, these devices and merge applications are called "print systems."

Printer Code Templates
When you use the Automation and Enterprise editions of BarTender, you can create a document todesign your items and then export the document to a printer code template, which is a data file that
contains printer commands and placeholders for data on your template. You can then merge andprint the printer code template by using your print system.
A printer code template contains mostly native printer code, but it also contains delimited fields thatthe print system can recognize and use to merge user input information. These delimited fields can
indicate positions (such as the start and end of each line) or data field names, which are used asplaceholders that are replaced at print time by actual data.
Not every print system uses every possible delimiter, but the template might include a header,footer, start and end line delimiters, start and end print code delimiters, and delimiters at the startand end of data fields.
For more information, refer to the Working With Printer Code Templates topic in the BarTender help
system.

Exporting Printer Code Templates3Printing with Printer Code Templates
Sometimes, it is not useful to send a printer code template (PCT) directly to a printer, because thedelimiters would appear as data on your printed items. Instead, you might want to store a PCT inside
a computer program or hardware device that is programmed to replace the placeholders with actual
data. The printer code that BarTender produces is not usable until the PCT is "merged" with the datathat you want to print.
No matter what environment you eventually use your PCT in, the process for setting it up is thesame, as follows:
1. Use BarTender to design your items, and then export your document to a PCT.
2. Upload the PCT 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.

Exporting Printer Code Templates

4

PCTs are used in a number of different environments, as described in the following sections.

Embedded Printer CodeAs most people know, before personal computers were available, software ran on very large
mainframe computers. In some of the first software programs that were designed for supply chain
management, programmers hand-coded all of the printer code that was required for their jobs andthen compiled it as part of the program. Changes to the design, no matter how small, required
programmers to manually change these sections of embedded printer code.
Some of these legacy applications are still in use today. A more efficient way to manage the use ofembedded printer code is to use BarTender to generate a PCT to a file and then compile that printercode into the program. To change the design still takes time, because you have to run BarTender,
make your change, export a new PCT, and then recompile it into the external program. However,working with a good WYSIWYG program such as BarTender results in a much easier and faster way todesign items than hand-coding them.

SAPscript-ITF Integrations
SAPscript is a reporting engine that is available in SAP that supports the automated combination of
SAP-provided data with an externally-supplied PCT format called an Interchange Text Format (ITF). As
is the case with embedded printer code, you have to export a PCT from BarTender when you use thisengine, but you use the SAPscript-ITF PCT print system that is installed with BarTender. After you
export the PCT, you can “upload” it to the SAP system and then configure the SAP system to run theappropriate SAPscript report and merge the required data whenever an SAP transaction requires
one or more printed items.
Although the SAPscript-ITF system makes design template changes easier than physicallyembedding and compiling new printer code into the SAP application, you still might encounter
technical challenges. For more information, refer to the Technical Challenges of Printer CodeTemplates section of this technical document.

Portable Keypad Devices
Portable keypad devices include a portable keyboard, a small screen display, and a printer port.
These devices generally lack the intelligence of portable “data terminals” and typically do not haveconnectivity to the main company network. Most commonly, they are connected to a printer that is
wheeled around a warehouse on a cart or forklift.
A portable keypad device that is not running Windows and is not connected to the main network
cannot run software such as BarTender. However, many such devices can download and store PCTs.
They can then prompt a print operator for data, merge it with the PCT, and output the printer code to
the attached printer.

Exporting Printer Code Templates5XML-enabled Printers
Most thermal printers provide a full and robust printer language, but some of them also have an
option to accept PCTs. As is the case with the embedded printer code and portable keypad devices,
you first must design an item and then export a PCT in BarTender for subsequent download to theprinter. After you do this, you can choose to send data only (without printer code) to the XMLenabled printer.

Non-Windows Environments
Even if a controlling software program is not running on Windows, you can use Integration Builder tointegrate your system with BarTender. If your controlling application does not have access toWindows computers on the network, you can embed PCTs to take advantage of Windows-basedlabel and barcode design (although not Windows-based printing).

Exporting Printer Code Templates

6Technical Challenges of Printer Code Templates
To generate PCTs, you must be running the Automation or Enterprise edition of BarTender. However,
BarTender does not serve as the print engine for the print jobs, unlike the more conventional
scenario in which you print items by using BarTender directly. When you use PCTs, BarTender cannot
provide the variety of advanced barcode design and printing features that we have developed overmany years.
The technical and security-related challenges of using PCTs include the following.

Required Coding Knowledge
When you use BarTender as your print engine, you need not worry about the technical details of how
to communicate with your printer. By contrast, to embed code into your other software, you must
know how to code in the language in which that software was written and be able to read,manipulate and embed large sections of printer code.

Extensive Design Changes
When you use BarTender as your print engine, you can modify your template design andautomatically be ready to print again. By contrast, when you use a PCT, you must do the following, nomatter how small a design change you make:l

Use BarTender to modify your design.

l

Export your design to a PCT.

l

Re-embed the PCT into your application and then recompile it or re-download it to yourhardware device.

Complicated Printer Maintenance
When you use BarTender as your print engine, if a printer fails and needs to be replaced, you canprint to the new printer right away. Also, if you change printer brands, you need only specify adifferent printer driver.
By contrast, when you store PCTs in a printer that later fails, you usually have to call for technicalsupport to get your production restarted with a replacement printer, even if you continue to use thesame printer model. Typically, only technical support personnel know how to run whatever custom
process your company uses for deploying PCTs. Also, if you change printer brands, custom
programming is usually required.

No Print Job Status Monitoring
When you print by using Drivers by Seagull™, you have access to important printer and print job
status information, such as the following:lPrinter online or offlinelPrint job running or stalledlPrinter low on paperlPrinter stopped

Exporting Printer Code Templates7All of this information is available by using the Printer Maestro companion application.
By contrast, when you print by using PCTs, you typically are printing without any knowledge of yourprinter’s status, unless you coded your own support to provide status monitoring.

No Support for Multiple Printer Models
When you use BarTender as your print engine, you can quickly select a different printer. Also, if a print
job fails due to a stopped or unavailable printer, you can use the Printer Maestro interface to dragthe print job to a different printer brand or model.
By contrast, because PCTs are, by definition, code for a specific printer, you cannot “move” a failed
print job to a different brand of printer. In fact, the different printer models that most manufacturers
produce have enough differences among them that you typically need different PCTs for each model.
(We have even seen cases in which printer models that otherwise were identical had different
firmware versions that required slightly different PCTs.)

No Support for Changing Graphics
PCTs cannot support the reading and printing of different graphics objects for different printed items.
For example, if you wanted to print a different picture from a database next to each barcode on yourinventory labels, you could not use a PCT.

No Paragraph Formatting
BarTender offers a wide variety of paragraph formatting features, including word wrapping,indentation, justification, bullets, numbering and line spacing. PCTs do not allow for this kind ofparagraph formatting.

No Variable Font Sizes
When you use BarTender as your print engine, you can use the Auto Fit property page for a text
object to automatically increase or decrease the font size depending on the amount of text that isused on each item.
By contrast, PCTs require that each text object uses the same font size for each item.

Loss of Security and Audit Preparation Features
Many BarTender companion applications have features that you can use to restrict printing access,log errors, or set up a document-sharing environment. History Explorer uses these features for its
auditing functions. PCTs bypass these features.

Loss of Advanced Print Management Functions
Printer Maestro is an advanced tool that can monitor every printer and print job on a Windows
network and display the status information on one screen. PCTs bypass the standard Windows
functions that make these management features possible.

Exporting Printer Code Templates8Adding Template Field Names
Barcode and text objects into which the print system inserts data must have a template field nameso that the print system can find them in the PCT file. Objects that are linked to BarTender data entry
controls or database fields are automatically given template field names when you export a
BarTender document to a PCT. For example, when you enable data entry for an object, a template
field name is automatically generated when the BarTender document is exported to a PCT.
You can also manually specify a custom name for a template field. To do this, follow these steps:
1. On the File menu, click Export Printer Code Template. The Export Printer Code Template
dialog opens.
2. Click More Options. The Printer Code Template Options dialog opens to the Template Fields
tab.
3. In the left navigation pane, select the data source that you want.
4. In the Template Fieldarea, select a source forthe new data field in the
Source list.
5. In the Name field, enter aname for the new data
field.
6. Optionally, click to selectthe Add Field Delimiters
check box.
7. Click OK to close thePrinter Code Template
Options dialog.
8. Click Close to close the Export Printer Code Template dialog.

Exporting Printer Code Templates9Exporting a Printer Code Template
BarTender is installed with some predefined print systems. To export a PCT for your BarTender
document to one of these print systems, follow these steps:
1. On the File menu, click Export Printer Code Template. The Export Printer Code Template
dialog opens.
2. In the Print System list, select a print system. Custom print systems are also listed here.
3. Click Export.
4. Resolve any issues that appear in the Export Printer Code Template: Verification Messages
dialog. For more information, refer to the Verification of Printer Code Templates chapter of thistechnical document.
5. Click OK to close the confirmation message.
You can export a printer code template as one file, or you can break it up into format and data printercode. Typically, printers can accept the following types of printer code:llFormat code: Defines initialization commands, fonts, the positions of the objects, and any
data that does not change from item to item.
Data code: Typically changes from item to item and uses the format printer code commands
as a format template for printing items by using the changing data.

Exporting Printer Code Templates

10Verification of Printer Code Templates
When you use BarTender as the print engine, it controls the entire print job, so it can easily perform
advanced printing functions and other functions. For example, BarTender can control how text is
centered, set the barcode density, add human readable text, and add check digits where needed.
However, a print system typically does not have this level of control. The print system uses raw
printer code and can only merge user input data into itself. The barcode density, for example, cannot
be adjusted, because the print system does not change the printer code. Because of this limitation,
the design of the template is very important.
When you export a PCT, BarTender reports design issues by using the Export Printer CodeTemplate: Verification Messages dialog, which helps you improve printing success when you use
the selected print system. You can manually correct or, in some cases, automatically fix the reported
problems.

Click Details to open the Message Details
dialog, which displays more information
about the issue to help you decide how toresolve the error.

Exporting Printer Code Templates

11Customizing Print Systems
In addition to the predefined print systems that BarTender provides, you can create your own
custom print system by using the Printer Code Template Setup dialog. You can configure any
number of custom print systems.
To open this dialog, click Printer Code Template Setup on the Administer menu in BarTender.

The following delimiters are available:l

Header: Marks the beginning of the PCT.

l

Footer: Marks the end of the PCT.

l

Start of Line: Marks the beginning of each line of printer code.

l

End of Line: Marks the end of each line of printer code.

lStart Field Delimiter: Marks the beginning of each data field (meaning each template fieldname). For more information, refer to the Adding Template Field Names section of thistechnical document.

l

End Field Delimiter: Marks the end of each data field.

lStart Print Code: Marks the point at which the printer code begins.

l

End Print Code: Marks the points at which the printer code ends.

Many print systems do not use all of these delimiters.

Search and Replace
Use the search and replace functionality to resolve potential conflicts between your printer's
language and the template field syntax that you are using. For example, if the character that you
want to use as the start field delimiter, such as the ampersand (&), is used in your printer's language,
you must temporarily replace the character where it appears in the printer's language code.
Otherwise, the print system interprets every instance of this character as the start of a template

Exporting Printer Code Templates

12field. The print system reverses this temporary substitution as the last step before it produces aprinter file that is written entirely in the printer's language.
To use the search and replace functionality, follow these steps:
1. On the Administer menu in BarTender, click Printer Code Template Setup. The Printer CodeTemplate Setup dialog opens.
2. Click the General tab.
3. Click Action List. The Search and Replace (Printer Code Modifier) dialog opens.
4. In the Action Options area, enter your search and replace terms in the Search for andReplace with fields.
5. Optionally, click Test to test the search and replace action.
6. Click OK to close the Printer Code Modifier: Action List dialog.
7. Click OK to close the Printer Code Template Setup dialog.
For more information, refer to the Search and Replace Dialog (PrinterCode Modifier) topic in the BarTender help system.

Exporting Printer Code Templates

13

Example of How to Use a Printer Code Template
Suppose Ajax Swizzle Sticks, Inc., wants its SAP/R3 system to print the following address labels.

The return address remains the same on all labels, but each line of the recipient’s address isvariable. On the warehouse floor, a non-Windows computer that is running a SAP/R3 print systemprompts the print operator to enter the recipient’s name and address. The SAP/R3 print systeminserts this information into a PCT that was created in BarTender, and the resulting printer file is sent
to a printer.
To create a PCT that has variable data fields:
1. In BarTender, start a new BarTender document, or open an existing document that you wantto modify.
2. On the File menu, click Print. The Print dialog opens.
3. In the Name list, select the printer that you want to use to print the labels. Make sure that theprinter driver supports the exporting of PCTs and that that feature is selected in the driver’s
Properties dialog.
4. Click Close to close the Print dialog.
5. For the return address, create a normal wrapped (multi-line) text object, and then place it in
the upper left corner of your template.
6. Click the text object to enter Edit mode, and then enter the return address.
7. Create another text object, and then place it where you want the recipient’s name to appear.
8. Double-click the border of the new object. The Text Properties dialog opens.
9. In the left navigation pane, click Font.
10. In the Typeface list, select a printer-based font.
11. In the left navigation pane, click the data source that you want under Data Sources.
12. On the Data Source tab, enter Recipient's Name in the Embedded Data field.

Exporting Printer Code Templates

1413. Click Close to close the Text Properties dialog.

You do not have to enable data entry for the object, because
the prompting is done by the SAPscript, not by BarTender.
14. Repeat steps 7 through 13 to create, place, and configure text objects for "Street
Address," "City," "State," and "Zip".
15. On the BarTender File menu, click Export Printer Code Template. The Export Printer CodeTemplate dialog opens.
16. Next to Print System, click More Options. The Printer Code Template Options dialog opens to
the Template Fields tab.
17. In the left pane, click the “Recipient’s Name" data source.
18. In the Source list in the Template Field area, select Custom.
19. For Name, enter Recipient’s Name.
20. Click to select the Add Field Delimiters check box.
21. Repeat steps 18-21 for the “Street Address,” “City,” “State,” and “Zip” data sources.
22. Click OK to close the Printer Code Template Options dialog.
23. In the Export Printer Code Template dialog, select SAPscript-ITF in the Print System list.
24. In the Output area, click to select All in One File.
25. Click Export. A template file that resembles the following is produced. The contents of the filevary depending on the printer that you selected in step 3. (In this example, a Datamax printerwas used.) Note that the fields that you created are enclosed in ampersands (&), which is the
SAPscript-ITF field delimiter.

Exporting Printer Code Templates

1526. Upload a copy of this file to a computer on the warehouse floor.
27. Configure SAP/R3 to perform the following actions:a. Open the SAPScript-ITF file.
b. Prompt the print operator for address data (the recipient’s name, street address, andso on).
c. Insert the data in place of the data source fields (&Recipient’s Name&, &Street
Address&, and so on) in the template.
d. Send the resulting file to the printer.

Exporting Printer Code Templates

16

Related Documentation
Technical Documentsl

BarTender Integration MethodslDrivers by Seagull™

l

Optimizing Print PerformancelStatus Monitoring

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

User GuideslGetting Started with BarTender
https://support.seagullscientific.com/hc/categories/200267887

BarTender Help SystemlWorking With Printer Code TemplateslSearch and Replace Dialog (Printer Code Modifier)Other Resources
Please visit the BarTender website at https://www.seagullscientific.com.

© 2020 Seagull Scientific, Inc. BarTender, Intelligent Templates, Drivers by Seagull, the BarTenderlogo, and the Drivers by Seagull logo are trademarks or registered trademarks of Seagull Scientific,
Inc. All other trademarks are the property of their respective owners.

Version 2020-10-30 Copyright © 2020 Seagull Scientific, Inc.