zebra zq500 Android: Prints with large space

S Said ZIANI 3 years ago
46 4 0

Hello,
I am on an Android project to print a label contains images and text.
I managed to print both but the problems that are printed with a large space at the beginning and between the two elements.
You have an idea to allow me to print without space please. Thank you.
here is the sample code used:

public static int TestZebra(final String theBtMacAddress, String sCodeZPL, String LogoimagePath, String DriverSignatureimagePath){final String pageDescriptionLanguage = "zpl";int Resultat = 0;BluetoothConnection thePrinterConn = new BluetoothConnectionInsecure(theBtMacAddress);try {// Open the connection - physical connection is established here.thePrinterConn.open();ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.ZPL, thePrinterConn);int labelCount = Integer.parseInt(SGD.GET("odometer.total_label_count", thePrinterConn));String zplData = sCodeZPL;int x = 0;int y = 0;//zplData =// ^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR5,5~SD10^JUS^LRN^CI0^XZ// ^XA// ^MMT// ^PW575// ^LL0100// ^LS0// ^FT476,37^A0I,54,117^FH\^FDHello Test^FS// ^PQ1,0,1,Y^XZif (DriverSignatureimagePath != ""){printer.printImage(DriverSignatureimagePath, 0, 0, 200, 200 , false);}thePrinterConn.write(zplData.getBytes());int newLabelCount = Integer.parseInt(SGD.GET("odometer.total_label_count", thePrinterConn));if (labelCount + 1 == newLabelCount){System.out.println("Print Successful.");Toast.makeText(getApplicationContext (),"Print Successful.",Toast.LENGTH_SHORT).show();Resultat = 1;}//else reprint?else{System.out.println("Print NOT Successful.");Toast.makeText(getApplicationContext (),"Print NOT Successful.",Toast.LENGTH_SHORT).show();Resultat = 0;}} catch (Exception e) {// Handle communications error here.e.printStackTrace();}finally {try {// Close the connection to release resources.thePrinterConn.close();} catch (ConnectionException ec) {// Handle connection close error here.ec.printStackTrace();}}return Resultat;}

Please register or login to post a reply

4 Replies

S Said ZIANI

Hello Dmitry,
I too print the label well but with a space of the same length that the text looks for example to print two successive labels. in fact I do not want the white space between the two texts and at the end.
I would like to print "Hello Test" just after the first message and stop right at the end of the message "Hello Test"
thank you

S Said ZIANI

Hello Demitry,
thank you very much, the command works well if I print an image but not for a text.
I send these commands just before printing:
! U1 setvar "media.type" "journal"
! U1 setvar "media.feed_length" "200"
! U1 setvar "zpl.label_length" "200" "
according to my search on the forums I think it is necessary to send the command ~ jc ^ xa ^ jus ^ xz but I do not know where I put this order?

D Dmitry Prokhorov

Hello Said,

Could you please to share a photo of your label that is demonstrating the issue?
Also could you please to perform following SGD command and share resulted allcv report:
! U1 getvar "allcv"Here is article on how to capture allcv report in a proper way:
Using the SGD Allcv Command  ! U1 getvar "allcv"

Also you may download Zebra Printer Setup utility from Google Play store and use it to configure your printer. It could be the easiest way to resolve your issue.

Dmitry Prokhorov
Software Engineer, Kutir Mobility
Posted on behalf of Zebra Technologies

D Dmitry Prokhorov

Hello Said,

Could you please to perform a following SGD command and share complete result here:
! U1 getvar "allcv"

Here is information on how to capture report properly:
Using the SGD Allcv Command ! U1 getvar "allcv"

Dmitry Prokhorov
Software Engineer, Kutir Mobility
Posted on behalf of Zebra Technologies

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