3

As the title says Is there any option to print the arabic content ZPL Printer.

Thing tried is adding the font and initiate the print

^XA ^FX ^FR ^CF0,40^CI28^FO130,45^FH^FD محاكمة Font file^FS ^XZ

My printer has TT0003M_.TTF font installed but it shows "????" when i tried to print arabic using

^XA^FO50,50^AE:TT0003M_.TTFN,50,50^FDمحاكمة^FS ^XZ

Any idea how to install a font and print the arabic text using ZPL language?

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101

2 Answers2

3

^XA^CI28^CW1,E:TT0003M_.TTF^LL130^FS
^PA0,1,1,1
^FO50,50^A1N30,30^FDمحاكمة‏ ^FS
^XZ

Updated this answer to match the other question

Also found this on the Zebra KB - https://km.zebra.com/kb/index?page=content&id=SO6820&actp=RSS

banno
  • 1,529
  • 8
  • 12
  • I tried your code but I still have issues with displaying the arabic fonts. It shows ???? – ZAJ Jul 11 '17 at 08:03
  • Are you sure that the font is on the system and that the font has the characters you need? You also need to be very careful that the tool or code you are using is handling unicode properly. – banno Jul 11 '17 at 14:07
  • Yes I am sure that the font is on the printer. **You also need to be very careful that the tool or code you are using is handling unicode properly. ** I am using the Zebra setup utilities---Open communication with printer to test and design the label – ZAJ Jul 12 '17 at 07:07
  • Please see my question here where I have described in details https://stackoverflow.com/questions/45030196/utf-8-character-not-printing-with-zebra-printer – ZAJ Jul 12 '17 at 07:09
1

Maybe it is too late to answer your question :) but I have the same issue and I solve it so I want to share my answer.


1- You can use ZebraDesigner 3 or "BarTender Designer" to design your ZPL code.

2- Use this font ZEBRA Swiss Unicode, it support Arabic characters.

3- After finish your design click Print and check the box "Print to file" then click Print and save the file with extension ".prn".image

4- Open the file using notepad and you will see the ZPL code.

5- Here is the result

^FPH,3^FT225,224^A@N,141,141,TT0003M_^FH\^CI28^FDمحاكمة^FS^CI27

Or the full result in this image.

6- If you are using online zpl viewer like this don't worry if you can't see the Arabic characters, but if you want to print you will not see any problems

7- Don't try to make your text in the center ,usin this will cut and reverse the Arabic text

  • The default is Field Text > "^FT"or with x,x"^FTx,y" "^FT225,224" like in this code:

    ^FPH,3^FT225,224^A@N,141,141,TT0003M_^FH\^CI28^FDمحاكمة^FS^CI27

  • If you try to center,right or left your Arabic text it will use Field Block "^FB" "^FB383,1,75,C" it is different than "^FT" and it is not supporting Arabic text.

    ^FPH,3^FT225,224^A@N,141,141,TT0003M_^FB383,1,75,C^FH\^CI28^FDمحاكمة^FS^CI27

  • you can see Field Block properties in this book at page 169

8- I'm not sure but I tried very hard and there is no way to center the arabic text until now.

  • But I have a trick using ^FT width to calculate the center

Using this function ,it is c#:

//Define page_width and font_width 

int page_width = 600;
int font_width = 18;

call the function it will return X position (center).

string ar = "محاكمة محاكمة محاكمة";

string FT_center = center_line(ar);

here is the function, 315 = middle width or center point

public string center_line(string arabic_text)

    {

        int text_width = (arabic_text.Length * font_width) / 2;
        decimal d = ((page_width - (text_width / 2)));
        int x = Convert.ToInt16(Math.Round(d)) ;
        x = 315 + (text_width / 2);
        return x.ToString();

    }

use it like this:

^FPH,3^FT"+FT_center+@",224^A@N,141,141,TT0003M_^FH\^CI28^FDمحاكمة^FS^CI27
husham14
  • 15
  • 1
  • 5