0

I want to print a bill with header, body and footer on continuous label.

  • The header is OK but the problem in the body and footer.

  • The body has items and more items can be added so the height should increase.

  • The footer come after the body, so how can I define footer's location.

  • Here is the bill

ZPL Code:

^XA
^LT0
^MNN
^MTT
^PON
^PMN
^LH0,0
^JMA
^PR6,6
~SD15
^JUS
^LRN
^CI27
^PA0,1,1,0
^XZ
^XA
^MMT
^PW599
^LS0
^FPH,3^FT375,751^A@I,28,27,TT0003M_^FH\^CI28^FDMy Market^FS^CI27
^FPH,3^FT353,708^A@I,28,27,TT0003M_^FH\^CI28^FDBill No:^FS^CI27
^BY3,3,47^FT533,639^BCI,,Y,N
^FH\^FD>;1112223334445556667788^FS

^FO36,564^GB529,0,3^FS

^FPH,3^FT543,503^A@I,28,18,TT0003M_^FH\^CI28^FDNo.^FS^CI27
^FPH,3^FT328,503^A@I,28,18,TT0003M_^FH\^CI28^FDName^FS^CI27
^FPH,3^FT133,503^A@I,28,18,TT0003M_^FH\^CI28^FDPrice^FS^CI27

^FO37,487^GB529,0,3^FS

^FO37,480^GFA,49,204,68,:Z64:eJxjUGBioBAxSCS2UYiAZjzus3jcRwnJwAAAnjM7/Q==:C016

^FPH,3^FT341,451^A@I,28,27,TT0003M_^FH\^CI28^FDWater^FS^CI27
^FPH,3^FT139,456^A@I,23,22,TT0003M_^FH\^CI28^FD$ 10^FS^CI27
^FPH,3^FT541,451^A@I,28,27,TT0003M_^FH\^CI28^FD01^FS^CI27

^FO36,413^GFA,49,204,68,:Z64:eJxjUGBioBAxSCS2UYiAZjzus3jcRwnJwAAAnjM7/Q==:C016

^FPH,3^FT139,380^A@I,23,22,TT0003M_^FH\^CI28^FD$ 19.99^FS^CI27
^FPH,3^FT328,375^A@I,28,27,TT0003M_^FH\^CI28^FDMilk^FS^CI27
^FPH,3^FT541,375^A@I,28,27,TT0003M_^FH\^CI28^FD02^FS^CI27

^FO36,331^GFA,49,204,68,:Z64:eJxjUGBioBAxSCS2UYiAZjzus3jcRwnJwAAAnjM7/Q==:C016

^FPH,3^FT342,302^A@I,28,27,TT0003M_^FH\^CI28^FDBread^FS^CI27
^FPH,3^FT138,307^A@I,23,22,TT0003M_^FH\^CI28^FD$ 5^FS^CI27
^FPH,3^FT540,302^A@I,28,27,TT0003M_^FH\^CI28^FD03^FS^CI27
^FPH,3^FT325,221^A@I,28,18,TT0003M_^FH\^CI28^FDTotal^FS^CI27

^FO39,249^GB529,0,3^FS

^FPH,3^FT339,178^A@I,28,18,TT0003M_^FH\^CI28^FD$ 34.99^FS^CI27
^FPH,3^FT354,102^A@I,28,18,TT0003M_^FH\^CI28^FDThank You^FS^CI27

^FO40,133^GFA,49,204,68,:Z64:eJxjUGBioBAxSCS2UYiAZjzus3jcRwnJwAAAnjM7/Q==:C016

^PQ1,0,1,Y
^XZ

I'm using xamarin android to print a ZPL Code, so can I do it using only ZPL Code or should I do it programmatically by changing Y Positon for each line?

Raynoceros
  • 386
  • 2
  • 15
husham14
  • 15
  • 1
  • 5
  • If you are writing the zpl, just keep track of your top field offsets, splat the footer afterwards. – TheGeneral Mar 04 '20 at 08:34
  • Why are you using ``^FPH`` and ``^FH\`` all over the place? – Delphi Coder Mar 04 '20 at 09:31
  • @Delphi Coder I'm using Zebra Designer and that is the zpl code result for my design ,so I don't know what are those, they are already in the code :| – husham14 Mar 04 '20 at 10:27
  • You can use a variable, in which store initial location from TOP. And increase the variable value for each line – Colonel Software Mar 04 '20 at 11:34
  • X-Y answer? Don’t use ZPL. Use standard rendering and print as a bitmap (https://stackoverflow.com/a/27792141/138200). That way you can use XAML. – Mitch Mar 04 '20 at 11:38

2 Answers2

1

You have to calculate the Y position of the footer programmatically depending on the number of items in the body.

Delphi Coder
  • 1,723
  • 1
  • 14
  • 25
0

When I did something like this, I calculated the Y Position for each line as:

Start Position + Pixels Per Record * (Record Number - 1)

For the footer you can do something nearly the same:

Start Position + Pixels Per Record * Record Count

EdHayes3
  • 1,777
  • 2
  • 16
  • 31