Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New line in Zebra ZPL

  1. How do I put new line characters for my "Text"? Say for example:

    Hello World
    

    will become

    Hello
    World
    

    Is there anyway that I can put a new line character for my code like this?

    ^FT78,76^A0N,28,28^FH\^FDHello\nWorld^FS
    
  2. If the "text" in my label is too long, how would I put another line to it?

like image 884
SleepNot Avatar asked Nov 16 '12 12:11

SleepNot


3 Answers

Use \& for new line

^FT78,76^A0N,28,28^FH\^FDHello\&World^FS
like image 53
Dharmesh Prajapati Avatar answered Sep 19 '22 08:09

Dharmesh Prajapati


I suggest you combine the answers from Thorsten and Dharmesh for maximum effect:

^FB400,2,0,C^FO0,50
^FDHello\&World^FS

Doing so will yield a label that looks like this:

result saying "Hello World"

The nice things about this approach are two: First, the text block will position and align the new line appropriately. And second, you have complete control over where the line break actually takes place.

like image 27
Jonny Avatar answered Sep 21 '22 08:09

Jonny


I know this question is pretty old, but I found out that the ^FB command (Field Block) is actually pretty good at wrapping text:

I used a line like this:

^A0R,54,54^FO505,3424^FB630,2,0,L,0^FDThis is a pretty long line of text^FS

and it got wrapped into two lines nicely. The only thing you need to mind is that wrapping seems to take place at spaces only, not at commas or any other punctuation marks.

like image 24
Thorsten Dittmar Avatar answered Sep 21 '22 08:09

Thorsten Dittmar