How to change default orientation for ZQ520

I'm printing with Android app to ZQ520 printer.

 

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

Gregory Pawlik
Hi Adil,Does your app use the


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

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Adil Akram
Hi Greg,Thanks for your help

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

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Gregory Pawlik
Hi Adil,Try the following

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

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adil Akram
Hi Greg,Thanks for your reply

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Gregory Pawlik
Adil,Actually, the simplest


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);

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adil Akram
Hi Greg,Yes, this simplest

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Gregory Pawlik
Adil,Are you saying that

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());

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Adil Akram
Greg,Thanks for your support.

Greg,

Thanks for your support. It worked for me.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


vikas kamble
Hi Gregory,can you give code

Hi Gregory,

can you give code snippet for the same problem for iOS app??

thank and regards

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments