8 Replies Latest reply on Mar 24, 2016 1:55 AM by Adil Akram

    How to change default orientation for ZQ520

    Adil Akram

      I'm printing with Android app to ZQ520 printer.

       

      It's printing upside down, how can I change default setting for this.

        • Re: How to change default orientation for ZQ520
          Greg Pawlik

          Hi Adil,

           

          Does your app use the Link-OS™ Multiplatform SDK | Zebra ?

           

          If so, it is probably creating an instance of a ZPL printer rather than  CPCL printer since the ZQ520 is considered a ZPL printer.

          In ZPL, the label prints in the opposite direction that CPCL would.

           

          To fix the orientation, you can either create an instance of a CPCL printer by specifying CPCL as the PrinterLanguage of your ZebraPrinter instance.

           

          Or you can simply write the following ZPL command to the connection before calling your printImage function:

          "^XA^POI^XZ"

           

           

           

          Greg

            • Re: How to change default orientation for ZQ520
              Adil Akram

              Hi Greg,

               

              Thanks for your help.

               

              We have used zebra RW 420 printer and use the following code to print an image.

               

              Code:

                 printer = ZebraPrinterFactory.getInstance(connection);

                 connection.write("! U1 JOURNAL\r\n! U1 SETFF 50 2\r\n".getBytes());

                 printer.getGraphicsUtil().printImage(bitmap, 0, 0, 820, 700, false);

               

              but we bought new printer ZQ520 and we have following problem to print image in android

               

              ISSUE: It's printing upside down and it's orientation is change.

               

              Please provide us the code or SDK to print image properly with new printer ZQ520.

               

              We need to resolve this issue in urgent basis. So, Please help us to move forward.

               

              We appreciate your help in advance.

               

              Thanks & Regards,

               

              Adil

               

              ZQ520

                • Re: How to change default orientation for ZQ520
                  Greg Pawlik

                  Hi Adil,

                   

                  Try the following code:

                   

                    printer = ZebraPrinterFactory.getInstance(connection);

                    connection.write("^XA^POI^XZ".getBytes());

                    printer.getGraphicsUtil().printImage(bitmap, 0, 0, 820, 700, false);

                   

                   

                   

                  Greg

                    • Re: How to change default orientation for ZQ520
                      Adil Akram

                      Hi Greg,

                      Thanks for your reply.

                       

                      I tried the code you provided, it didn't work. There's no difference it's printing same upside down.

                        • Re: How to change default orientation for ZQ520
                          Greg Pawlik

                          Adil,

                           

                          Actually, the simplest code for you may be:

                           

                          printer = ZebraPrinterFactory.getInstance(PrinterLanguage.CPCL, connection);

                          connection.write("! U1 JOURNAL\r\n! U1 SETFF 50 2\r\n".getBytes());

                          printer.getGraphicsUtil().printImage(bitmap, 0, 0, 820, 700, false);

                            • Re: How to change default orientation for ZQ520
                              Adil Akram

                              Hi Greg,

                              Yes, this simplest code I have in place since beginning.

                               

                              Actually the printImage() method prints image differently on both printers i.e. RW 420, ZQ 520

                               

                              An there's no way to fix this different behavior.

                                • Re: How to change default orientation for ZQ520
                                  Greg Pawlik

                                  Adil,

                                   

                                  Are you saying that there is no change in orientation when you specify the PrinterLanguage when creating an instance of the printer?

                                   

                                  If you specify a PrinterLanguage of CPCL such as:

                                   

                                  ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.CPCL, connection);

                                  printer.printImage(new ZebraImageAndroid(bitmap), 0, 0, 550, 412, false);

                                   

                                   

                                  Then the default orientation would be upside down as compared to specifying a PrinterLanguage of ZPL:

                                   

                                  ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.ZPL, connection);

                                  printer.printImage(new ZebraImageAndroid(bitmap), 0, 0, 550, 412, false);

                                   

                                   

                                   

                                  You can also manipulate the orientation of a CPCL printer instance by adding the TURN command in your datastream:

                                   

                                  ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.CPCL, connection);

                                  connection.write("! U1 TURN 0\r\n".getBytes());

                                  printer.printImage(new ZebraImageAndroid(bitmap), 0, 0, 550, 412, false);

                                   

                                  OR

                                   

                                  ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.CPCL, connection);

                                  connection.write("! U1 TURN 180\r\n".getBytes());

                                  printer.printImage(new ZebraImageAndroid(bitmap), 0, 0, 550, 412, false);

                                   

                                   

                                   

                                  The ZPL equivalent would be:

                                   

                                  ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.ZPL, connection);

                                  connection.write("^XA^POI".getBytes());

                                  printer.printImage(new ZebraImageAndroid(bitmap), 0, 0, 550, 412, true);

                                  connection.write("^XZ".getBytes());

                                   

                                   

                                  OR

                                   

                                  ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.ZPL, connection);

                                  connection.write("^XA^PON".getBytes());

                                  printer.printImage(new ZebraImageAndroid(bitmap), 0, 0, 550, 412, true);

                                  connection.write("^XZ".getBytes());

                                  1 of 1 people found this helpful