Domanda

I'm trying to find a solution to print superscript using ZPL.

Example, if I have this string of ZPL:

string ZPLString =
    "^XA" +
    "^FO50,50" +
    "^A0N50,50" +
    "^FDHello, World!^FS" +
    "^XZ";

sendToZebraPrinter(ZPLString);

Since there aren't any superscript characters, I could send this to my printer without issue. But if I wanted to use this string:

string ZPLString =
    "^XA" +
    "^FO50,50" +
    "^A0N50,50" +
    "^FDe = mc²^FS" +
    "^XZ";

sendToZebraPrinter(ZPLString);

The superscript won't print natively. I think I need to access an international character set or something but I'm not sure how to do this, especially if I only need it for the one character. Do I need to change my entire character set, or do some sort of "replace" on it?

Note, we are generating ZPL code manually and shooting it directly at the printers (unfortunately this is our system), bypassing any drivers or 3rd party dev components of any kind.

È stato utile?

Soluzione 2

Try using ^CI13 to select code page 850, then use _fd in your string for the superscripted 2. The underscore is used to designate a hex character.

Altri suggerimenti

Mark's answer gave me exactly what I needed to solve my issue. Here is additional information to further clarify the solution:

  1. To use the hex code in your data you need to prefix the ^FD command with ^FH_ (where ^FH tells the printer the data in ^FD will contain hex values and the _ defines the hex code identifier so it knows which data is or is not defined as a hex code instead of standard text)

  2. I got this to work immediately exactly as you mentioned. Then testing against additional printers I found (but not sure why) that I didn't need to actually send in the ^CI13 to specify code page 850. The ² appeared on all printers even when I didn't send the ^CI13

  3. In my .NET application, for some reason the ² didn't map to the correct hex code that the ZPL code page expected (the .NET app converted ² to hex code b2 instead of fd, but for most standard characters converted to the same code as the ZPL map) so in my application I created a conversion table where any character I defined in my table I mapped to the ZPL hex code and any character I didn't define I allowed to remain as converted by the application).

I'd never used information from the non default code page and I didn't realize when using ^FH that you could mix standard text with hex (I thought if you used ^FH that "all" of the information in ^FD had to be hex). So the information Mark provided let me right down the correct path.

The final example to solve the problem, using the information Mark provided, is:

string ZPLString =
    "^XA" +
    "^FO50,50" +
    "^A0N50,50" +
    "^FH_" +
    "^FDe = mc_fd^FS" +
    "^XZ";

sendToZebraPrinter(ZPLString);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top