ESC/POS & Metapace T-3 : print 2D barcodes, print small fonts

3,479 views
Skip to first unread message

Val

unread,
Aug 27, 2012, 11:52:30 AM8/27/12
to jzebra...@googlegroups.com
Hi all,

I'm working on printing tickets with Metapace T-3.

1/ Print 2D barcodes
I am currently stuck : I can not make 2D barcodes (QR Code, PDF417).

I spent several hours reading the doc several times, trying to find informations on the net without success.
Even the examples provided in the doc does not run, in contrast to the 1D codes, wich print without problem.


Example script sent to jZebra :

\x1B\x40 \x1D(k\x0d\x00\x30\x50\x30TEST PRINT
\x1D(k\x03\x00\x30\x51\x30


2/ Print small fonts
ESC/POS, unlike ZPL, do not give me the option to choose the character height.
I can only choose the font size :
- 1 : default size
- 2 : default *2
- 3 : default *3
...

How can I reduce the size ?
Did I missed something ?

Tres Finocchiaro

unread,
Aug 28, 2012, 1:33:38 AM8/28/12
to jzebra...@googlegroups.com
Val,

I'm not very familiar with ESC/P, but I see you are trying to print a PDF417 stacked linear barcode symbol format barcode.  Since this is a 2D barcode, this is very similar to syntax for a QRCODE.

Example:
Inline image 1


GS ( k = specify and print the symbol

For others on the mailing list, this is on Page 83 of the metapace command manual (linked here).

The manual has some unexplained items:
  • Is "cn" of "48" specified each print?
  • Is "cn" of "48" specified in hex "\x30" or decimal "48" ?
  • Is "fn" of "65, 66, 67, 68" specified in each print?
  • Is "fn"  of "65, 66, 67, 68"  specified in hex "\x41", "\x42", "\x43", "\x44" or decimal?
  • What syntax are columns, rows, modules, height?  Are they all mandatory?
Some things the manual is very clear about:
  • You must store the data with "80" before you print it with "81".
I've searched multiple ESC/P manuals with no reference to "GS ( k", so you may need to call Metapace for better clarification on the syntax.

-Tres

--
To unsubscribe from this group, send email to jzebra-users...@googlegroups.com
 
http://code.google.com/p/jzebra



--
- Tres.Fin...@gmail.com
image.png

Tres Finocchiaro

unread,
Aug 28, 2012, 2:15:09 AM8/28/12
to jzebra...@googlegroups.com
I just realized to learn each function, you need to search the document for that function.

i.e. "<Function 080>" = stores the PDF417 symbol data (d1...dk) in the symbol storage area = Page 92.

This is extremely confusing to learn.  Here's what I've gathered so far... 

Default - no need to send - Automatic numbering of columns = 0/auto (page 86)
\x1D\x28\x6B\x03\x00\x30\x41\x00

Default - no need to send - Automatic number of rows = 0/auto (page 87)
\x1D\x28\x6B\x03\x00\x30\x42\x00

Default - no need to send - Width of dots = 3 (page 88)
\x1D\x28\x6B\x03\x00\x30\x43\x03

Default - no need to send - Module height = 3 (page 89)
\x1D\x28\x6B\x03\x00\x30\x44\x03

Error correction level - Very confusing!?
\x1D\x28\x6B\x04\x00\x30\x45\xMM\xNN

Default PDF417 behavior - 00 = Standard, 01 = Simplified (Page 91)
\x1D\x28\x6B\x03\x00\x30\x46\x00

Stores the PDF417 symbol data (d1...dk) in the symbol storage area (Page 92) What is pL, pH, d1, dk?
\x1D\x28\x6B\xpL\xpH\x30\x50\x30    d1... ...dk

Encode and print PDF417 barcode (Page 93) What is m?
\x1D\x28\x6B\x03\x00\x30\x51 m

I have no idea what these parameters are supposed to be... :(

-Tres
image.png

Val

unread,
Aug 28, 2012, 7:02:24 AM8/28/12
to jzebra...@googlegroups.com
Hi Tres :)

Thanks for your messages !
You bring me more questions than answers ^^ I totally agree that the language + its documentation are very "confusing".

Here is how it works for the example script :
\x1B\x40 : Initialize printer (ESC @) \x1D(k\x0d\x00\x30\x50\x30TEST PRINT : Function 080, stores the data in the symbol storage area (GS ( k pL pH \x30 \x50 \x30 data)
\x1D(k\x03\x00\x30\x51\x30 : Function 081, encodes and print the symbol
pL, pH is used to set the number of bytes following pH to (pL + pH x 256) [found page 60...]

Hoping help ! :-)

Val

unread,
Aug 30, 2012, 5:33:01 AM8/30/12
to jzebra...@googlegroups.com
Hello all :)

Does someone in the group has a printer that supports ESC / POS to test the code I provided above ? (Epson, Samsung / Bixolon / Metapace ...)
;-)

--
Val

nrivoli

unread,
Sep 20, 2012, 7:24:41 PM9/20/12
to jzebra...@googlegroups.com
Hello.
Did you fix this?

I did a raw hexadecimal printing, directly from the drivers and I got this:

1d 28 6b 03 00 30 41 04 //cn = Hex30Dec48 fn = Hex41Dec65 Set the number of columns in the data region  <Function 065>
1d 28 6b 03 00 30 43 02 //cn = Hex30Dec48 fn = Hex41Dec67  Set the width of the module  <Function 067>
1d 28 6b 07 00 30 50 30 "68 6f 6c 61"  //cn = Hex30Dec48 fn = Hex41Dec80 Store the data in the symbol storage area   <Function 080>
1d 28 6b 03 00 30 51 30 "68 6f 6c 61" 00  //cn = Hex30Dec48 fn = Hex41Dec81  Print the symbol data in the symbol storage area  <Function 081>
1b 33 00 00 0a  //set line spacing 
1d 56 42 00  //CUT MODE AND CUT PAPER   42HEX->66DEC

"68 6f 6c 61"  is my data "hola" (hello in spanish)

But i  can't reproduce it, writing the same output in javascript

nrivoli

unread,
Sep 21, 2012, 1:29:52 AM9/21/12
to jzebra...@googlegroups.com
Well... finally I could not do this directly from jZebra.
I was testing something like...


document.jzebra.append('\x1b\x40');
document.jzebra.append('\x0d');
document.jzebra.append('\x0a');

document.jzebra.append('\x1D\x28\x6B\x03\x00\x30\x41\x04');
document.jzebra.append('\x1D\x28\x6B\x03\x00\x30\x43\x02');
document.jzebra.append('\x1D\x28\x6B\x07\x00\x30\x50\x30\x68\x6F\x6C\x61');
document.jzebra.append('\x1D\x28\x6B\x03\x00\x30\x51\x30\x68\x6F\x6C\x61\x00');
document.jzebra.append('\x1B\x33\x00\x00\x0A');
document.jzebra.append('\x1D\x56\x42\x00');

document.jzebra.append('\x0d');
document.jzebra.append('\x0a');

(...)




then I created a file... with Hex contents (binary? or something like that) with http://mh-nexus.de/en/
then loaded from URL
document.jzebra.appendFile("http://localhost/jZebra-1.4.5/dist/b5.hext");
document.jzebra.print();



and works like a charm.
But I don't like that approach..

Any help?

My printer is Sewoo LK-T200 and I am following this: www.point2vente.com/downloads/manuels/epson_tmt_88v.pdf (english)


Tres Finocchiaro

unread,
Sep 21, 2012, 8:46:56 AM9/21/12
to jzebra...@googlegroups.com
Yes, The \x00 is impossible with JavaScript.  Try 
Replacing \x00 with applet.appendNull().  This is because JavaScript uses nulls as special characters.


-Tres

nrivoli

unread,
Sep 21, 2012, 2:31:59 PM9/21/12
to jzebra...@googlegroups.com
Hello!

You say, I should do this
document.jzebra.append('\x1D\x28\x6B\x03');
document.jzebra.appendNull();
document.jzebra.append('\x30\x41\x04');

for
document.jzebra.append('\x1D\x28\x6B\x03\x00\x30\x41\x04'); 

but I'm still not receiving \x00 into hexadecimal printing mode.
I am using v1.4.5

Tres Finocchiaro

unread,
Sep 21, 2012, 3:08:07 PM9/21/12
to jzebra...@googlegroups.com
Here's the link to the bug report about the \x00.


The "appendNull()" may not work, as I didn't have an Epson to test it on.  You may have better luck forcing UTF-8 encoding, but again, this is untested.

Alternatively, you can dynamically generate the print commands using a server-side language such as ASP, C#, PHP, etc and provide the link to that page using the same appendFile() function (i.e. (appendFile("http://mysite/print_commands.php?var1=x&var2=y");)

if anyone has more success with the 

nrivoli

unread,
Sep 21, 2012, 3:13:33 PM9/21/12
to jzebra...@googlegroups.com
Hello.

I tested a lot.. but nothing happens, but checking issue #61 ...
This seems a reasonable solution
(and works as expected)
<?php
//hex to bin
$str = ('1D286B03003041041D286B03003043021D286B0700305030686F6C611D286B0300305130686F6C61001B3300000A1D564200');
$str = base64_encode(pack('H*',$str));
?>
document.jzebra.append64('<?=$str?>');
document.jzebra.print();


File printing works too.
Reply all
Reply to author
Forward
0 new messages