Frage

I need to encode "date field" in my Zebra M4Plus printer from UTF-8 to UTF-16. For this I need to use "required translation table". In documentation I found this:

~DER:JIS.DAT,27848,300021213001...

But I don-t know what is JIS.DAT and why 27848.

This is my code example:

qz.append("^XA");
qz.append("^FO160,635");
qz.append("^A@R,30,30,E:TT0003M_.FNT");
qz.append("~DER:.DAT,27848,Данные для вывода^FS"); - it not work. Printer go to offline.

Who has experience with this, help please.

War es hilfreich?

Lösung

Please try forcing the Java applet to use Cyrilic: qz.setEncoding("cp1251"); or qz.setEncoding("windows-1251"); unless the printer natively supports UTF-16, then qz.setEncoding("UTF-16");

Update: In newer versions of QZ Tray, the syntax is qz.configs.create("My Printer", { encoding: 'UTF-8' });

Also, make sure to define <meta charset="utf-8"> in your web page.

Edit: There's a detailed explanation of what causes this here: Printer ZebraZ4MPlus don't print Russian Cirillyc character

Java has a habit of assuming what character set you want to use, which is often cp1252 (Windows) or UTF-8 (*nix). Depending on which encoding the printer is expecting (and which encodings it supports), Java first needs to translate these characters/commands to a suitable equivalent before sending. A full list of encodings supported by Java 7 is available here.

A very similar question was posed on the qz bug tracker in regards to Greek character support. The trick was to tell both Java as well as the printer which language/character encoding was being used.

Finally, I've had scenarios where the BOM flag (Byte Order Mark) on the html/js file has caused undesirable results. In that case, JavaScript was aware of the document's encoding and translation was occurring before sending to Java. I use Notepad++ to switch UTF-8 BOM on/off.

In addition, here is the link to the qz bug report, which is in regards to a different printing language (ESCP instead of ZPL), but has a similar symptom of the output from Java getting transposed incorrectly for his printer. https://code.google.com/p/jzebra/issues/detail?id=204#c10

-Tres

Andere Tipps

The ZPL manual explains (on page 171) that the this command is downloading a translation table to help convert a font over to unicode: ZPL manual. The number (27848) is the size of the downloadable format of the font. These tables can be downloaded at Zebra's Website as part of your font pack. What font are you attempting to use?

Also, while this doesn't fix the problem of the printer turning off, you should end your ZPL command with an "^XZ". This is the command used by the printer to denote the end of a label/job/command.

jason.zissman, thanks for link on new documentation. I find there encoding CI28. I post from JSP (<%@page contentType="text/html" pageEncoding="UTF-8" %>) js-code:

qz.append("^XA");
qz.append("^CWX,E:TT0003M_.FNT^FS");
qz.append("^CI28");
qz.append("^FO50,400^AX,80,70^FDCyrillic: ЖЛЗ^FS");
qz.append("^XZ");
qz.print();

But the printer prints only "Cyrilic:". What's the problem? When I print this from file - all good, and from jsp - not work.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top