Search code examples
javaprintingzebra-printers

Not able to store graphics on Zebra GK420t - JAVA - Windows 8.1


I'm trying to store an image on a Zebra GK420t printer before printing. This image must be converted pcx black and white before being sent through the commands of the documentation. With the command "GI", the printer prints a ticket if the image has been saved or not.

The "GM" command allows me to save the image, I tried to send a file containing the path of the image, directly send the image path in string but nothing happened. The "GK" command just above deletes an image stored in the machine that has been registered before with the same name as the one that I want to store now.

I do not understand why my order is wrong. I join you the doc and my code in hopes that someone could help me.

I already managed to print the same pcx file with a Zebra GK420t thanks to a java code based on Linux and not Windows, so I am sure that the size of my picture is not a problem.

I tried a lot of things, here are 2 examples:

http://zupimages.net/up/16/30/y60w.png

http://zupimages.net/up/16/30/b811.png

Thank you :)


Solution

  • I finally found out how to print a graphic, I'm posting the answer for future users.

    Here is the java code :

    http://zupimages.net/up/16/31/yrwe.png

    In fact, I had to realize that the printer could understand EPL code and ZPL code. As I tried everything I could around the EPL I decided to send things in ZPL and it worked !

    First step :

    • Register your graphic in the printer. You need to download - ZebraNet Bridge Enterprise -, that ables you to convert your picture into a zpl file.

    • When you're done, you need its code. For example, open it with with the bloc note so that you can copy the data and send it directly to the printer.

    Finally :

    Send :

    "^XA";

    "^FO20,20^XGR:{NAMEOFGRAPHIC},1,1^FS"

    "^XZ";

    to print the graphic.