PxPlus User Forum

Twitter Twitter Twitter

Author Topic: ZPL II Programming in PxPlus  (Read 874 times)

umbriano

  • New Member
  • *
  • Posts: 1
    • View Profile
ZPL II Programming in PxPlus
« on: December 18, 2018, 04:51:41 PM »
Does anyone have an example of a barcode label print program using Zebra's ZPL II programming language that I can use for reference. I am having a hard time transitioning from using the EPL programming language to the ZPL II programming language. Any help would be appreciated.

Allen Miglore

  • Silver Member
  • ***
  • Posts: 26
    • View Profile
    • UnForm
Re: ZPL II Programming in PxPlus
« Reply #1 on: December 18, 2018, 05:12:43 PM »
I don't have a print program (that would be our product, UnForm), but I've attached a sample of output from it.

Hopefully this will help.

-Allen

GordDavey

  • Member
  • **
  • Posts: 6
    • View Profile
Re: ZPL II Programming in PxPlus
« Reply #2 on: December 18, 2018, 05:13:27 PM »
How about:

      Data$ = ""
      Data$ += "^XA^LRN^CI0^XZ" ! start format, reverse image, FontEncoding, stop format
      Data$ += "^XA" ! Start format
      Data$ += "^MMT^JZY" ! Tearoff, reprint on error
      Data$ += "^LT0^PON^PMN^LH0,0^JMA" !
      Data$ += "^PW812" ! Label Width in dots (from 203 dot GK420T)
      Data$ += "^LL1218" ! Label Length in dots (from 203 dot GK420T)
      Data$ += "^LS0" ! Label shift to 0
      Data$ += "^FO34,750^GB738,417,8^FS" ! Draw Box
      Data$ += "^FT619,985^A0I,169,196^FH\^FDSTOP^FS" ! ! STOP
      Data$ += "^FT724,820^A0I,118,122^FH\^FDDo Not Apply^FS" ! DO NOT APPY
      Data$ += "^FT507,665^A0I,66,70^FH\^FD" + This'FormatContainerID$(ContainerID$, 0) + "^FS" ! Human Readable Bar Code Value - ContainerID last 6 digits
      
      if CompanyCode$ > "" \
         then Data$ += "^FT770,560^A0I,51,52^FH\^FD" + "Inv: " + CompanyCode$ + " " + InvoiceNo$ + " " + This'DisplayDate$(InvoiceDate$) + "^FS" ! Text Comp InvoiceNo InvoiceDate
      
      if CustomerCode$ > "" then \
      {   
         tmp$ = stp(stp(CustomerAbbrev$, 2) + " " + CustomerCode$ + "-" + ShipToCode$ + " " + ShipToProvAbbrev$, 2)
         Data$ += "^FT770,495^A0I,51,52^FH\^FD" + "Cst: " + tmp$ + "^FS" ! Text CustAbbv, Cust#, ShipTo#, Prov
      }
      
      Data$ += "^FT770,395^A0I,51,52^FH\^FDError:^FS" ! Text Error
      Data$ += "^FT630,395^A0I,51,52^FH\^FD" + str(ErrorCode) + "^FS" ! Text ErrorCode
      
      ! Error Text, we need to watch out for how LONG the text is
      ! Seems to be 40 chars per line, max 5 lines
      tmp$ = stp(ErrorText$, 2), line = 0
      dim line$[ 1 : 5 ]
      
      while tmp$ > ""
         if line >= 5 \
            then break
            
         if len(tmp$) <= 33 then \
         {
            Line$[ ++line ] = tmp$, \
            tmp$ = ""
         } else \
         {
            x = pos(" ,." : tmp$(1, 34), -1)
            if x >= 18 then \
            {
               Line$[ ++line ] = stp(mid(tmp$, 1, x - 1))
               tmp$ = stp(mid(tmp$, x + 1), 2)
            } else \
            {
               Line$[ ++line ] = stp(mid(tmp$, 1, 33))
               tmp$ = stp(mid(tmp$, 34), 2)
            }
         }
      wend
      
      LineY = 330
      if Line$[1] > "" \
         then Data$ += "^FT770," + str(LineY) + "^A0I,51,52^FH\^FD" + Line$[1] + "^FS"; LineY -= 65 ! Text ErrorText Line 1
      if Line$[2] > "" \
         then Data$ += "^FT770," + str(LineY) + "^A0I,51,52^FH\^FD" + Line$[2] + "^FS"; LineY -= 65 ! Text ErrorText Line 1
      if Line$[3] > "" \
         then Data$ += "^FT770," + str(LineY) + "^A0I,51,52^FH\^FD" + Line$[3] + "^FS"; LineY -= 65 ! Text ErrorText Line 1
      
      Data$ += "^PQ1,0,1,Y^XZ" ! Print Quality 1, pause&cut, replicates, Override pause count
Gord Davey <gord.davey@daveycomputing.com>
President - Gord Davey Computing
Tel: +1 (519) 835-4322