variable replace prn templet file problem

I'd like to use c# code and zpl command to print a file on zebra printer

step 1)create a prn templet file

step 2) c# code to replace variables in prn file and send file to zebra printer.

problem:

I'd like to use Code128 auto on label

if variables are numbers, it's ok.

if variables are numbers mixed letters, the barcode will be longer than input value in templet file directly.

e.g.

CT~~CD,~CC^~CT~

^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2~SD22^JUS^LRN^CI0^XZ

^XA

^MMT

^PW799

^LL0400

^LS0

^BY2,3,100^FT30,241^BCN,,Y,N

^FD>:##NEWBATCH##^FS

^PQ1,0,1,Y^XZ

##NEWBATCH## is variables, value will be  0123456789A01234B0123, but if I try to input this value into prn file directly instead of  variable "##NEWBATCH## " ,then I will see

CT~~CD,~CC^~CT~

^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2~SD22^JUS^LRN^CI0^XZ

^XA

^MMT

^PW799

^LL0400

^LS0

^BY2,3,100^FT30,241^BCN,,Y,N

^FD>:0123456789>6A>50123>64B>50123^FS

^PQ1,0,1,Y^XZ

value 0123456789>6A>50123>64B>50123 instead of  0123456789A01234B0123

value 0123456789>6A>50123>64B>50123 is right.

my question is how to convert "0123456789A01234B0123" to "0123456789>6A>50123>64B>50123",

what is the convert rule of zebra designer?(any c# code sample?)

Anonymous (not verified)
Hi Steven,I'm not sure I


Hi Steven,

I'm not sure I understand the question, so please let me know if this is not an answer.

I don't know why the designer is converting the letter the way you are showing.  Code128 can take alpha characters directly.  If your intention is to encode 0123456789A01234B0123, then just use that after the "^FD>:"

Try modifying the prn file to something like the following:

CT~~CD,~CC^~CT~

^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2~SD22^JUS^LRN^CI0^XZ

^XA

^MMT

^PW799

^LL0400

^LS0

^BY2,3,100^FT30,241^BCN,,Y,N

^FD>:0123456789A01234B0123^FS

^PQ1,0,1,Y^XZ

As for sample code, Are you using the Link-OS SDK or doing something else?

If the SDK, I have some sample code posted here:   .  Just replace the ZPL_STRING with the contents of the prn file or read the prn file into a byte[] and send that.  If you want to use this as a template, which we do recommend, take a look at the FormatUtil Interface and the sample code GitHub - Zebra/LinkOS-PC-Samples at ZSDK_DevDemos_.NET for a full demo of template based printing.

I hope this is what you were looking for,

Robin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Steven Wu
Thanks Robin,I found the

Thanks Robin,

I found the solution.

important ZPL.png

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments