Printing Items Using BTXML Script

BTXML Script provides a simple way for users to pass instructions to BarTender that define how to print a document. Using BTXML Script tags, you can create scripts that allow you to print a single simple item or hundreds of complex designs. The sections below introduce some basic scripts and explain the result of each script. Refer to the topics in the reference section for a complete list of all available BTXML tags and instructions on how to use them to automate your printing processes.

ClosedBasic Printing

The following example demonstrates a simple BTXML Script that opens and prints the BarTender document Document1.btw.

<?xml version="1.0" encoding="utf-8"?>

<XMLScript Version="2.0">

<Command Name="Job1">

<Print>

<Format>c:\BarTender\Document1.btw</Format>

</Print>

</Command>

</XMLScript>

Seagull recommends that you specify the complete path and file name of your BarTender documents. If the path is not specified and you are sending the BTXML script as a file, the path will be relative to the location of the BTXML file. If the file isn't found at this location, or the BTXML is being sent as a string, the BarTender default document location is used.

ClosedCustomizing the Print Job

In addition to opening and printing a BarTender document, you can set various document settings before printing.

The following example opens the document Document1.btw, and sends a print job containing 100 serialized items to Tray 1 of the HP LaserJet printer. See the Reference section for a full description of all available tags.

<?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>

ClosedExecuting Multiple Print Jobs

You can send more than one print job within a single BTXML file or string. To do this, include a <Command> section for each print job you want to send.

The following example sends 3 print jobs (3 different <Command> sections) to the printer. Each job opens a different document, prints 5 copies and closes the document without saving it.

<?xml version="1.0" encoding="utf-8"?>

<XMLScript Version="2.0">

<Command Name="Job1">

<Print>

<Format CloseAtEndOfJob="true">Document1.btw</Format>

<PrintSetup>

<IdenticalCopiesOfLabel>5</IdenticalCopiesOfLabel>

</PrintSetup>

</Print>

</Command>

<Command Name="Job2">

<Print>

<Format CloseAtEndOfJob="true">Document2.btw</Format>

<PrintSetup>

<IdenticalCopiesOfLabel>5</IdenticalCopiesOfLabel>

</PrintSetup>

</Print>

</Command>

<Command Name="Job3">

<Print>

<Format CloseAtEndOfJob="true">Document3.btw</Format>

<PrintSetup>

<IdenticalCopiesOfLabel>5</IdenticalCopiesOfLabel>

</PrintSetup>

</Print>

</Command>

</XMLScript>

Related Topics