Printing Items by Using BTXML Script

BTXML script provides a way for users to pass instructions to BarTender that define how to print a document. By using BTXML script tags, you can create scripts that print a single simple item or hundreds of complex designs. The following sections introduce some basic scripts and describe the result of each script. For a complete list of all available BTXML tags and instructions about how to use them to automate your printing processes, refer to the topics in the reference section.

ClosedBasic Printing

The following sample code shows a simple BTXML script that opens and prints the BarTender "Document1.btw" document.

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

<XMLScript Version="2.0">

<Command Name="Job1">

<Print>

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

</Print>

</Command>

</XMLScript>

We recommend that you specify the complete path and file name of your BarTender documents. If the path is not specified and you send the BTXML script as a file, the path is relative to the location of the BTXML file. If the file is not found at this location, or if the BTXML is sent as a string, the BarTender default document location is used.

ClosedCustomizing the Print Job

You can customize various document settings before you run a print job.

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. For a full description of all available tags, refer to the reference section.

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

ClosedRunning Multiple Print Jobs

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

The following sample code sends three print jobs (in three different <Command> tags) to the printer. Each job opens a different document, prints five copies, and then 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