Scan and Print Automatically

Article ID: 87284591

Issue / Question

How do I scan a barcode and automatically print a label containing this data? How do I connect the scanner to a printer with the Bluetooth Classic Radio?

Applicable To

ZPL, ZebraDesigner, 123Scan

Resolution / Answer

NOTE Zebra Support Community Site has been updated to replace obsolete industry terms with modern terminology. This article uses the term Central instead of Master, and Peripheral instead of Slave

There are two methods to scan a barcode with a barcode reader and automatically print it on the printer connected to the reader.

  • The printer can be connected by Bluetooth (BTLE is not supported) or over a network connection.
  • If you intend to connect the scanner to the USB HOST port of the printer, follow the next article:

Standalone Printing: Print Station Used With USB Host Port

To connect the barcode reader to the printer via Bluetooth follow these steps:

  1. Set the scanner to Central.
  2. Open 123Scan, click Barcodes > Bluetooth Barcodes > Serial port profile (Central) pairing bar code.

  3. Create a Mac Address Bluetooth Pairing Label. (For Mobile Printers, generate the MAC Address Pairing Bar code by printing a 2-key test or print from the LCD Display.)
  4. In the Pairing value field, enter the printer Bluetooth MAC address, and click on the generate bar code button.

  5. Pair the scanner by scanning the Mac Address Bar Code.
    The pairing of the devices will be accomplished by scanning the barcode printed by the printer.
NOTE Verify the scanner has the latest firmware installed and observe the case sensitivity if the barcode pairing label is created manually.

Scan & Print:

Method 1
This method is used to store a label template on the printer memory and recall it each time the barcode reader reads the barcode you want to print. Since the barcode must be configured to send a prefix and a suffix at every read, this method might be limited by the memory size of the barcode reader. Hence, do check your free or available memory before you begin. 

The first part will focus on configuring the printer and the first step is to use ZebraDesigner to create the template that contains all the fixed and variable fields you want on the final label.

  1. With the printer installed and connected to the computer, open a new label in ZebraDesigner and add all the fields you need, including the variable ones.
    In the following example, there is a fixed text field (Fixed text) and a Code 128 barcode type variable field.

  2. Save the file with a filename no longer than 8 characters and ensure it does not contain spaces in between. (example.nlbl in this case).
  3. Click on File and select Store.
  4. Select the Print to file checkbox, and save the example.prn file at a known location to be used later.
    Repeat the previous step, but deselect the Print to file checkbox and choose Internal Flash under the Printer memory location so the file will be stored on the printer memory. 

    You can check if the file is on the printer memory by sending the following commands to the printer:
    One of the files should be EXAMPLE.ZPL
    You can find more information about this procedure in this article: Zebra Setup Utilities: Sending Printer Commands and Receiving Data. Open the example.prn file saved before with a text editor, and the following window pops up:

    • ^DFE:EXAMPLE.ZPL > This command instructs the printer to store the file instead of printing it.
    • ^FDFixed Text:^FS This is the fixed text field).
    • ^BY4,3,238^FT501,127^BCI,,Y,N,N,A > These are the features of the variable barcode field. It contains the barcode type, its position, size, etc.
    • ^FN11 > This is the empty variable field on the template which will be filled with the data read by the barcode reader.
    Read Using ZPL Stored Formats article (refer to Example 2) if you need further information about how to store and recall a format from the printer memory.

    Now that the printer is configured correctly, we can work on the barcode reader.
    Send the required ZPL code to the printer that will recall the template file and fill the variable field. This can be achieved by creating an Advanced Data Formatting (ADF) rule using 123Scan which will send the following prefix:
    and the following suffix:
    In detail, the prefix contains the command to open the label ^XA, then it recalls the EXAMPLE.ZPL file using the ^XF command and open the ^FN11 field that will be filled with the data read by the reader. The command contained in the suffix closes the ^FN11 tag with the ^FS command, adds the print quantity ^PQ1, and closes the label with the ^XZ tag. The <CR> and <LF> refer to Carriage Return and Line Feed respectively. This needs to be added at the end so that the printer confirms the action to print. Carriage Return is listed in 123Scan as <CTRL M/ENTER> and Line Feed is listed as <CTRL J/LINEFEED>.

    This step can be achieved using the 123Scan Utility as shown below:

    You can download the example file used in this article from here. Refer to the Creating an Advanced Data Formatting (ADF) Rule Using 123Scan  article for more details.   

    Method 2

    This method is used to create a barcode containing just a carriage return and is used to confirm the quantity. This operation can be done using ZebraDesigner 3
    • Step 1: Scan the barcode you want to print.
    • Step 2: Scan the carriage return barcode and the printer will print the label.
    With Step 1, you are sending the data you want to print to the printer, while Step 2 works like an enter pressed on the keyboard and it's needed to confirm the action to print.
    Below are two ZebraDesigner samples that contain the carriage return:

    Helpful Information:

+ Applicable Products

  • ZebraDesigner Pro
  • ZebraDesigner Pro