Swift - ZPL, printing correctly on first print when printer is turned on but incorrectly every print after?

D Danyal Butt 2 years 11 months ago
30 1 0

I am trying to send two print jobs to the printer . I am trying to print the a label in the correct orientation then using ^POI to print it a second time inverted. This works when the printer has first been turned on but then every print after the first it prints the 2 labels in the same orientation almost ignoring the ^POI.

My ZPL (zplData):

^XA^LL600^LS0^BY2,2,59^LH0,0^FT100,400^BQN,2,10^FD##\(attendee!.id)^FS^A0N,50,50^FO350,240^FD\(name)^FS^A0N,40,40^FO350,290^FD\(attendee!.company)^FS^XZ

(zplDataFlip):

^XA^POI^LL600^LS0^BY2,2,59^LH0,0^FT100,400^BQN,2,10^FD##\(attendee!.id)^FS^A0N,50,50^FO350,240^FD\(name)^FS^A0N,40,40^FO350,290^FD\(attendee!.company)^FS^XZ

My Swift to print:

if success! {
      thePrinterConn?.write(zplData.data(using: String.Encoding.utf8), error: errorPtr)
      thePrinterConn?.write(zplDataFlip.data(using: String.Encoding.utf8), error: errorPtr)
}

Please register or login to post a reply

1 Replies

D Danyal Butt

Figured it out. The printer saves the orientation of the print after ^POa is used, so you have to define what orientation you want every time.

My ZPL (zplData):

^XA
^PON^LL600^LS0^BY2,2,59^LH0,0^FT100,400^BQN,2,10^FD##\(attendee!.id)^FS^A0N,50,50^FO350,240^FD\(name)^FS^A0N,40,40^FO350,290^FD\(attendee!.company)^FS^XZ

(zplDataFlip):

^XA^POI^LL600^LS0^BY2,2,59^LH0,0^FT100,400^BQN,2,10^FD##\(attendee!.id)^FS^A0N,50,50^FO350,240^FD\(name)^FS^A0N,40,40^FO350,290^FD\(attendee!.company)^FS^XZ

CONTACT
Can’t find what you’re looking for?