zebra zq500 Android: Prints with large space

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^XZ

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

}

Dmitry Prokhorov
Hello Said,Could you please

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" <CR>

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Said,Could you please

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" <CR>

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

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Said ZIANI
Hello,thank you for your

Hello,

thank you for your reply. below the answer of the order! U1 getvar "allcv".

bluetooth.

bluetooth.discoverable : on , Choices: on,off

bluetooth.friendly_name : XXRAJ172600529

bluetooth.version : 5.5.2

bluetooth.date : 10/03/2017

bluetooth.local_name : XXRAJ172600529

bluetooth.address : B0:91:22:88:42:BD

bluetooth.bluetooth_pin : *

bluetooth.short_address : B091228842BD

bluetooth.radio_version : 4.0

bluetooth.enable : on , Choices: on,off

bluetooth.connected : no

bluetooth.minimum_security_mode : 1 , Choices: 1,2,3,4

bluetooth.connected_security_mode : nc

bluetooth.bonding : on , Choices: on,off

bluetooth.clear_bonding_cache

bluetooth.enable_reconnect : iOS_only , Choices: off,iOS_only

bluetooth.le.

bluetooth.le.controller_mode : both , Choices: both,classic,le

bluetooth.json_config_channel_enable : on , Choices: on,off

bluetooth.page_scan_window : 60 , Choices: 15,60

card.

card.inserted : Not Inserted

card.cisproc : Processed

card.mfgid : 

card.cardid : 

card.fncode : 000c

card.idtext1 : 

card.idtext2 : 

card.idtext3 : 

card.idtext4 : 

card.fcrbase : Not Detected

card.fcrlist : NONE DETECTED

card.defcfg : Not Detected

card.cor : Not Present

card.mac_addr : 00:00:00:00:00:00

card.mac_raw : 000000000000

card.enable : on , Choices: on,off

comm.

head.

head.latch : ok

head.resolution.

head.resolution.in_dpi : 203

ip.

ip.dhcp.

ip.dhcp.enable : on , Choices: on,off

ip.dhcp.cid_type : 1 , Choices: 0,1,2

ip.dhcp.cid_prefix : 

ip.dhcp.cid_value : 000000000000

ip.dhcp.requests_per_session : 2 , Choices: 1-10

ip.dhcp.request_timeout : 2 , Choices: 2-30

ip.dhcp.session_interval : 10 , Choices: 0-60

ip.dhcp.lease.

ip.dhcp.lease.length : 0

ip.dhcp.lease.time_left : 0

ip.dhcp.lease.server : 0.0.0.0

ip.dhcp.lease.last_attempt : 0

ip.dhcp.cache_ip : off , Choices: on,off

ip.dhcp.vendor_class_id : Zebra Technologies ZTC ZQ510-203dpi CPCL

ip.dhcp.user_class_id : 

ip.dhcp.option12 : on , Choices: on,off

ip.dhcp.option12_format : 

ip.dhcp.option12_value : XXRAJ172600529

ip.dhcp.cid_enable : off , Choices: on,off

ip.dhcp.cid_suffix : 000000000000

ip.dhcp.cid_all : 000000000000

ip.dhcp.arp_verify : off , Choices: on,off

ip.dhcp.auto_provision_enable : on , Choices: on,off

ip.dhcp.ntp.

ip.dhcp.ntp.enable : off , Choices: on,off

ip.dhcp.ntp.received_servers : 

ip.ftp.

ip.ftp.enable : on , Choices: on,off

ip.ftp.execute_file : off , Choices: on,off

ip.ftp.request_password : no , Choices: yes,no

ip.lpd.

ip.lpd.enable : on , Choices: on,off

ip.tcp.

ip.tcp.enable : on , Choices: on,off

ip.tcp.nagle_algorithm : enabled , Choices: enabled,disabled

ip.udp.

ip.udp.enable : on , Choices: on,off

ip.http.

ip.http.enable : on , Choices: on,off

ip.http.admin_name : admin

ip.http.admin_password : *

ip.http.port : 80

ip.http.faq_url : https://www.zebra.com/support.html

ip.http.custom_link_name : 

ip.http.custom_link_url : 

ip.smtp.

ip.smtp.enable : on , Choices: on,off

ip.smtp.server_addr : 0.0.0.0

ip.smtp.domain : ZBRPrintServer.com

ip.pop3.

ip.pop3.enable : on , Choices: on,off

ip.pop3.print_headers : off , Choices: on,off

ip.pop3.verbose_headers : off , Choices: on,off

ip.pop3.print_body : off , Choices: on,off

ip.pop3.save_attachments : off , Choices: on,off

ip.pop3.poll : 240 , Choices: 0-65535

ip.pop3.username : 

ip.pop3.password : *

ip.pop3.server_addr : 0.0.0.0

ip.pop3.print_attachments : off , Choices: on,off

ip.snmp.

ip.snmp.enable : on , Choices: on,off

ip.snmp.get_community_name : *

ip.snmp.set_community_name : *

ip.snmp.create_mib

ip.snmp.trap_community_name : public

ip.telnet.

ip.telnet.enable : on , Choices: on,off

ip.telnet.disconnect

ip.addr : 0.0.0.0

ip.netmask : 255.255.255.0

ip.gateway : 0.0.0.0

ip.port : 6101

ip.remote : 

ip.ping_remote

ip.netstat :

ip.remote_port : 10013

ip.remote_autoconnect : off , Choices: on,off

ip.bootp.

ip.bootp.enable : on , Choices: on,off

ip.mirror.

ip.mirror.auto : off , Choices: on,off

ip.mirror.username : user

ip.mirror.password : *

ip.mirror.server : 127.0.0.1

ip.mirror.path : Zebra

ip.mirror.freq : 0 , Choices: 0-65535

ip.mirror.fetch

ip.mirror.version : Sep 28 2018 13:55:43

ip.mirror.freq_hours : 0 , Choices: 0-100

ip.mirror.error_retry : 0 , Choices: 0-65535

ip.mirror.feedback.

ip.mirror.feedback.auto : off , Choices: on,off

ip.mirror.feedback.path : Zebra/feedback

ip.mirror.feedback.freq : 0 , Choices: 0-65535

ip.mirror.feedback.odometer : 0 , Choices: 0-4294967295

ip.mirror.success : no

ip.mirror.success_time : Mar 08 2019 15:47:16

ip.mirror.last_time : Mar 08 2019 15:47:16

ip.mirror.last_error : No Error

ip.mirror.mode : ftp , Choices: ftp,sftp

ip.mirror.reset_delay : 5 , Choices: 0-900

ip.mirror.interface : both , Choices: both,wired,wireless

ip.mirror.appl_path : 

ip.ping_len : 56 , Choices: 56-65535

ip.dns.

ip.dns.domain : 

ip.dns.servers : 

ip.discovery.

ip.discovery.enable : on , Choices: on,off

ip.discovery.port : 4201

ip.roam_packet : on , Choices: on,off

ip.arp_interval : 0 , Choices: 0-30

ip.primary_network : 2 , Choices: 2

ip.active_network : unknown

ip.ntp.

ip.ntp.enable : off , Choices: on,off

ip.ntp.servers : 

ip.ntp.log

ip.port_alternate : 9100

ip.port_json_config : 9200

ip.port_single_conn : 9300

ip.port_single_conn_idle_timeout : 180 , Choices: 0-3600

ip.tls.

ip.tls.enable : on , Choices: on,off

ip.tls.port : 9143

ip.tls.port_json_config : 9243

ip.https.

ip.https.enable : on , Choices: on,off

ip.https.port : 443

ip.firewall.

ip.firewall.whitelist_in : 

ip.ping_gateway_interval : 0 , Choices: 0-30

label.

label.x_move : 0 , Choices: -575-575

label.y_move : 0 , Choices: -32768-32767

media.

media.status : ok

media.sense_mode : gap , Choices: bar,gap

media.tof : 0 , Choices: -400.0-400.0

media.type : label , Choices: label,journal

media.bar_location : back , Choices: front,back

media.width_sense.

media.width_sense.enable : off , Choices: off

media.width_sense.in_mm : 72.1

media.width_sense.in_cm : 7.21

media.width_sense.in_dots : 576

media.width_sense.in_inches : 2.837

media.printmode : tear off , Choices: tear off,peel off,rewind,cutter,delayed cut,linerless peel,linerless rewind,linerless tear,applicator,linerless cut,linrless dly cut

media.speed : 5.0 , Choices: 1.0-5.0

media.feed_length : 20000 , Choices: 0-20000

media.feed_skip : 16 , Choices: 0-50

media.draft_mode : off , Choices: on,off

media.part_number : 

media.serial_number : 

sensor.

sensor.paper_supply : ok

sensor.peeler : clear

sensor.recall_factory_cal

sensor.peeler_present : Not Present

sensor.width.

sensor.width.cur : 72

sensor.width.in_dots : 576

sensor.gap.

sensor.gap.brightness : 161

sensor.gap.gain : 98

sensor.gap.offset : 0

sensor.gap.thold : 50

sensor.gap.cur : 77

sensor.gap.ppr_out_thold : 60

sensor.back_bar.

sensor.back_bar.brightness : 106

sensor.back_bar.gain : 100

sensor.back_bar.offset : 0

sensor.back_bar.thold : 70

sensor.back_bar.cur : 0

sensor.back_bar.ppr_out_thold : 70

sensor.front_bar.

sensor.front_bar.brightness : 109

sensor.front_bar.gain : 57

sensor.front_bar.offset : 0

sensor.front_bar.thold : 70

sensor.front_bar.cur : 0

sensor.front_bar.ppr_out_thold : 70

sensor.head.

sensor.head.temp : 59

sensor.head.temp_celsius : 26

sensor.head.temp_avg : 24

sensor.battery.

sensor.battery.cur : -101

sensor.battery.in_volts : 7.1

sensor.battery.avg : 181

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Thank you, Said.From you

Thank you, Said.

From you "allcv" report it looks like your problem could be due to following setting:

media.feed_length : 20000 , Choices: 0-20000

Seems 20'000 is too much. You can try to reduce it to 1200 that will be about 10 inches or to 600.

Also you need to check is your printing a label or receipt. In case it is a label, then you need to do

a short calibration with ZPL ~JC command:

https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf#page=226

Also it would be nice to see photos of your issue.

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Said ZIANI
Hello, look at an example of

Hello, look at an example of a label, I print a simple text followed by a table (I use the same function for both). Do you see the wide space?Zebra.jpg

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Said ZIANI
for example I printed a

for example I printed a signature, width 500 height 500. i placed the command "! U1 setvar" zpl.label_length "" 500 "before printing and look what gives me.In fact he printed the label (Length 500) advent a space (length 500 also) what I want is to stop in the length 500 please help. Thank you.Zebra2.jpg

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Said,Seems you need to

Hello Said,

Seems you need to adjust the two following variables:

! U1 setvar "media.type" "journal"

! U1 setvar "media.feed_length" "600"

It should work after that.

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Said ZIANI
Hello Demitry,thank you very

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?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Said ZIANI
look at the ZPL code used for

look at the ZPL code used for a simple wording:

CT~~CD,~CC^~CT~

^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR5,5~SD10^JUS^LRN^CI0^XZ

^XA

^MMT

^PW575

^LL0200

^LS0

^FT476,37^A0I,54,117^FH\^FDHello Test^FS

^PQ1,0,1,Y^XZ

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Said,I tested your SGD

Hello Said,

I tested your SGD and ZPL commands code. You have missed leading ~ character in very first ~CT command. Besides that your code is ok and working like a charm on my ZQ320.

I have all commands executed this way:

! U1 setvar "media.type" "journal"

! U1 setvar "media.feed_length" "200"

! U1 setvar "zpl.label_length" "200"

~CT~~CD,~CC^~CT~

^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR5,5~SD10^JUS^LRN^CI0^XZ

^XA

^MMT

^PW575

^LL0200

^LS0

^FT476,37^A0I,54,117^FH\^FDHello Test^FS

^PQ1,0,1,Y^XZ

And here is a photo of result:

photo_2019-03-13_23-36-15.jpg

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Said ZIANI
Hello Dmitry,I too print the

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

rebra3.jpg

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Said,With following SGD

Hello Said,

With following SGD and ZPL code:

! U1 setvar "media.type" "journal"

! U1 setvar "media.feed_length" "200"

! U1 setvar "zpl.label_length" "42"

~CT~~CD,~CC^~CT~

^XA~TA000~JSN^LT-28^MNW^MTD^PON^PMN^LH0,0^JMA^PR5,5~SD10^JUS^LRN^CI0^XZ

^XA

^MMT

^PW575

^LL0

^LS0

^FT476,0^A0I,54,117^FH\^FDHello Test^FS

^PQ1,0,1,Y^XZ

I was able to print that label:
photo_2019-03-17_21-40-20.jpg

Parameters I have tweaked are highlighted in code above by a bold font.

Please, see description of respective commands and parameters here:

https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments