##### Page tree
Go to start of banner

# Cutting Label Stock After a Batch Job on Zebra Printers

## Description

A customer would like to print to a Zebra printer, and have the printer cut the label stock after the entire batch has printed. According to the help, this can be accomplished by setting the Cut Interval to 0. However, we have a situation when printing to Zebra printers, where anything causing the label to print in Extended Mode, such as a script, will cause the printer to cut after each label has been printed. This effectively defeats the ability to cut the label stock after a batch job on a Zebra printer.

### Explanation

In order to get the printer to cut after a batch, we must remove the cutting ability from the printer's Options, and send a cut command after the last label in batch has been printed.

The following is a workaround to have the ability to cut after a batch job, even when the labels are being printed in Extended Mode. To summarize, we will be performing the following:

1. Turn the Cutting Mode off on the printer.
2. Identify the quantity of labels to be cut during printing.
3. Identify the current label being printed of the entire quantity.
4. Add a Pass Though field on the label to send a cut command once the final labels is being printed.
5. Add a script on the label to populate the Pass Though field with the cut command for the final label.

## Solution

The following describes the steps in detail.

1. Go into the printer's Options, and change the PrintMode from "Cutter" to "Tear Off".
2. Add a field on the label form called "Quantity". Make this a non-printing field with a Data Source of "Formula". The field should contain a Max # Chars setting of whatever the largest quantity of labels to be printed will be. For example, if the largest quantity of labels to be requested is 100, then the QUANTITY field should have a Max # Chars value of 3. The formula should reference the quantity of labels being printed as follows:

QUANT()

The name is not important, as long as it is referenced later on in a script to be added.

3. Add a field to the label called "ptfield_Cut. THIS FIELD MUST BE ON THE LABEL ITSELF IN ORDER FOR IT TO WORK. Make this a non-printing field with a Data Source of "Keyboard". The field should contain a Max # Chars setting of 30 to be able to hold the cutter commands being added to it from a script. A field on a label with a "ptfield" prefix creates what is called a Pass Though field. A Pass Though field is used to pass printer commands to the printer during the process of printing a label. This field must be on the label in order for the commands contained within it to be passed to the printer.

4. Add a field to the label form called "Count". Make this a non-printing field with a Data Source of "Incr/Decr". This field can be a form side field only. The field should contain a Max # Chars setting of whatever the largest quantity of labels to be printed will be. For example, if the largest quantity of labels to be requested is 100, then the Count field should have a Max # Chars value of 3. The Clear Value for the Count field should then be set to "001".

5. Either add a script to the label, or modify the existing script, to add the following;

Cut Command Script
```//Cut command script to be sent after final label is printed

// Set a variable to get the quantity of labels being printed
var qty = Number(label.fields.field.(@name == 'Quantity').@data);

// Set a variable to get the current count of the total labels printed of the total quantity
var count = Number(label.fields.field.(@name == 'Count').@data);

//Create the pass through command to populate the ptfield_Cut field when the last label is being printed
if(count==qty)
label.fields.field.(@name == 'ptfield_Cut').@data="^MMC"```

2014053

## Versions

All supported LPS family product versions.

## Environment

All supported installation environments