Printing Chinese via ZPL code without using font

K Kira Raki 3 years 7 months ago
374 2 0

Hello everyone,
 
Could you please take a look on my problem?
 
I am trying to printing Unicode characters via ZPL code without using font.
I was successful with some Unicode language by using hex in ZPL code.
For example:
^XA
^CI28
^FO60,75
^ASN,36,20^FH^FD_46_6c_c3_bc_67_65_6c^XZ
Result: Flügel
 
However, when I try to print Chinese with the same way, nothing is printed to the printer.
This is my python code for printing:
 
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#ZPL docs can be found at https://support.zebra.com/cpws/docs/zpl/zpl_manual.pdf
#This works with Python 2, change the str to bytes if you are using Python 3
import sys
import socket
import csv
import os
import pdb
import sys
import binascii
 
 
TCP_IP = '127.0.0.1'
TCP_PORT = 9100
BUFFER_SIZE = 4096
 
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print s
s.connect((TCP_IP, TCP_PORT))
 
 
zpl = """^XA
 
 
^CI28
^FO60,75
^ASN,36,20^FH^FD"""
zpl = zpl + "_" + "_".join("{:02x}".format(ord(c)) for c in "传傳")
    #zpl = zpl + "_e7_8e_ab"
zpl = zpl + """^XZ"""
print zpl
s.send(str(zpl))
 
 
s.close()
 
Thanks in advance for any helps.

Please Register or Login to post a reply

2 Replies

Z ZOOU Qinn

I have an issue similarly.
So far, I can print Chinese Characters correctly using "Zebra Setup Utilities" with ZPL commands below:
^XA
^CW1,E:SIMSUN.TTF
^SEE:GB18080.DAT^CI26
^FO200,10^A1N,36,20^FDEnglish汉字^FS
^XZ
I edited python code according the simple code on URL https://www.zebra.com/us/en/support-downloads/knowledge-articles/ait/Net...
# -*- coding: utf-8 -*-
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('168.168.183.199', 9100))
zpl = b'''
^XA
^CW1,E:SIMSUN.TTF
^SEE:GB18080.DAT^CI26
^FO200,10^A1N,36,20^FDEnglish汉字^FS
^XZ
'''
s.send(zpl)
s.close()
However, the Chinese characters on label is messy code as launching this script.
So, how to modifying this script?

E Efkan YILMAZ

Hi Kira,
Are you using a printer built for the Chinese or Asian market?  If you don't know, please post the part number on the the bottom or back of the printer.
If the printer is not built for the Asian market, the built in fonts will not have the Chinese characters.  Some European characters are supported, but Chinese was too large a font for the limited memory on many of our older printers. 
You can add a font if the printer has enough memory.

CONTACT
Can’t find what you’re looking for?