5

I have followig task:

I am generating sequence of consecutive barcodes eg: 117-1, 117-2, 117-3, 117-4...

I have to print labels with those barcodes: first label with first code, second label with second code and so on.

Currently I am printig labels one-by-one. Is it possible in ZPL to combine multiple labels to one command for printer? Something like:

^header
print first one
take next label
print second one
take next label
...
^footer

I am generating ZPL so there is no need to introduce variables in ZPL.

My current code for printing single label

    string zpl = string.Format(
    @"^XA
    ^LH5,5

    ^CF0,129
    ^FO20,10
    ^FB800,4,,C
    ^FD{0}
    ^FS

    ^FO160,150
    ^FB800,1,,C
    ^BY3
    ^BCN,150,N,N,N
    ^FD{0}
    ^FS
    ^XZ
    ", code.ToString());
mbednarski
  • 758
  • 1
  • 9
  • 17
  • It takes multiple ZPL commands to print one label. Also, you are controlling the stream so why are multiple label formats a problem? If you just want to write once to the printer put multiple labels in the string you are sending to the printer. – banno Apr 01 '14 at 13:49
  • If you are trying to reduce the number of characters you are sending to the printer use stored formats. – banno Apr 01 '14 at 13:50

1 Answers1

6

You can concatenate ZPL files to merge several labels into one.

Untested code would be something like this, if I understand your requirements:

String template = "^XA^LH5,5^CF0,129^FO20,10^FB800,4,,C^FD{0}^FS^FO160,150^FB800,1,,C^BY3^BCN,150,N,N,N^FD{0}^FS^XZ";

String zpl = String.format(template, code.toString());
      zpl += String.format(template, code2.toString());
      ...and so one, or use a loop
Brimstedt
  • 3,020
  • 22
  • 32