zaqaqaw / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 0 forks source link

Barcode printing not working on Zebra TTP2030 using ESC/P #118

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, I have been using jZebra for 3 years now with great success !

Right now I have a project to start printing barcodes and I am not getting 
anywhere, including the helpdesk from Zebra.

There is an example in the tech manual on page 48 bottom, they show an example 
in <ESC>BS<0><0><h 48>.... etc.
If I put these commands in a prn file and send it directly to the printer is 
accepts and will print the barcode. 
Now to put it in a html page I have to translate this to hex and set it all to 
\x1B\x26 format. I did this with a hex editor (xvi32), I did a transaltion of 
the original string with <ESC> commands into the hex editor and it got set to 
hex (1B, 26,46,1B,68,01 etc etc.)
The barcode does not print this way.

Its a funny problem, as I said, I have been using jZebra for printing for 3 
years and all the commands in the manual from zebra seem to work (bold, doubl 
height etc) except these barcodes.

Is there a way that I can use the <ESC>BS<0> codes directle, rather then 
hex-trans them first?

Any help would be much appreciated !!

Gerard

Original issue reported on code.google.com by gcromb...@gmail.com on 4 Mar 2013 at 6:43

GoogleCodeExporter commented 8 years ago
Gerard,

It is likely that the printer you are using is using the ESC/P emulation.

This is very popular for Epson printers.  Zebra specializes in their own 
languages (ZPL, EPL, etc) so they would not be the experts in this field.

The mailing list (jzebra-users@googlegroups.com) has a few people that have had 
much success with ESC/P.

For starters, I can tell warn that JavaScript is incompatible with the "Null" 
character, or "\x00", so if you are using that anywhere in your script, you may 
need to use "appendNull()".  Even this approach has had limited success, so 
most people prepare the data in base64 format using a server-side language and 
then use append64.

-Tres

Original comment by tres.fin...@gmail.com on 5 Mar 2013 at 4:01

GoogleCodeExporter commented 8 years ago
Hi Tres,

That is correct, I use "\x00" quite a few times for the barcode settings. 
('\x1B\x42\x53\x00\x00\x48\x00\x00\x00\x00\x40\x00\x02\x02' )

How can I apply appendNull() (as I could not find an example on the jZebra 
documentation).

And secondly, if I should use the base64 method; what exacttly should I 
'base64'? Is it the total string as in brackets above? Or should I just use 
hex-only code without the "\x"  ?

THanks for your reply !

-Gerard

Original comment by gcromb...@gmail.com on 6 Mar 2013 at 7:29

GoogleCodeExporter commented 8 years ago
Gerard,

>  1. How can I apply appendNull()

1. appendNull() can get ugly.  Here's how it's intended to be used (but again, 
there's been marginal success with it). 

Pseudocode, not tested. ;)

>  applet.append('\x1B\x42\x53');
>  applet.appendNull(); applet.appendNull();
>  applet.append('\x48');
>  applet.appendNull(); applet.appendNull();applet.appendNull(); 
applet.appendNull();
>  applet.append('\x40\');
>  applet.appendNull();
>  applet.append('\x02\x02');

Future versions will correct this by allowing a special character (probably 
"\\x00") and then replace it internally.

This bug is caused by JavaScript using the "\x00" null character to terminate 
Strings.  This is consistent across all browsers.

>  2.  I should use the base64 method; what exacttly should I 'base64'?

2.  Base64 would be done by a language other than JavaScript (php, asp, etc).  
Essentially.  The hex would look different, for example in php, I belive null 
is represented as "\0", so the hex would remain the same, but the escaping 
would follow that of your server language.

-Tres

Original comment by tres.fin...@gmail.com on 7 Mar 2013 at 1:19

GoogleCodeExporter commented 8 years ago
Hi Tres,

I have tried the appendNul() but it didnt work. I have resolved it by creating 
each time a file with all hex codes and then use the print file command with 
jZebra. This works great and have put it in production allready. Thank you for 
your support and quick responses !! Regards, Gerard

Original comment by gcromb...@gmail.com on 16 Mar 2013 at 6:01

GoogleCodeExporter commented 8 years ago
Changes 1.5.4:
- Fix for appendHex() now allows "x1B" instead of "\x1B", fixing the "\x00" 
bug.  Just use "x00".

Please test and let me know if it's working.

Also, I've fixed the bug in the appendNull() command so that should work too.  
Let me know if it fixes it.

-Tres

Original comment by tres.fin...@gmail.com on 3 Aug 2013 at 7:18

GoogleCodeExporter commented 8 years ago

Original comment by tres.fin...@gmail.com on 3 Aug 2013 at 7:22