imz320 Zebra Designer printing problem


We have an issue regarding printing and we were wondering wither you would be able to assist for a solution.


Firstly, I am using Zebra Designer to create a ZPL II file.


Secondly, I’m creating the ZPL file using the “print to file” command.




The main issue is that when the file is sent  to imz320 using  Zebra Setup Utilities with no issues whatsoever,


however when the file is sent via C# no printing occurs.




We are using Bluetooth connection in order to communicate with the zebra mobile printer.




Here is a small example of my source code:




ZebraSerialPort port = new ZebraSerialPort("COM4", 115200, 8, Parity.None, StopBits.One, Handshake.None, -1, -1);






                    FileStream fs = new FileStream(@"My Documents\zpl1.prn", FileMode.Open);






int nLength = Convert.ToInt32(fs.Length);


BinaryReader br = new BinaryReader(fs);


Byte[] bytes = new Byte[fs.Length];


bytes = br.ReadBytes(nLength);






port.Write(bytes, 0, nLength);








Anonymous (not verified)
Hi Panicos,Is the

Hi Panicos,

Is the ZebraSerialPort essentially a C# SerialPort object (System.IO)?  Have you verified the Serial port has been set up correctly on the OS?  I use TeraTerm on my PC to make sure the serial port has been set up by sending "~HI" without quotes and seeing the response.  Printer should respond with printer model number, firmware version, etc.

If so, have you verified the file is being converted to bytes correctly?  I use the code:

     private StringBuilder GetFile(string fileName)


         StringBuilder sb = new StringBuilder();

         if (File.Exists(fileName))


            string[] lines = System.IO.File.ReadAllLines(@fileName);

            foreach (string line in lines)



         return sb;


byte [] buffer = convertToBuffer(GetFile(@"My Documents\zpl1.prn"));

If your code is for a mobile device, which one and what IDE are you using?


Vote up!
Vote down!

Points: 1

You voted ‘up’

Panicos Makrides
Hello Robin and thanks for

Hello Robin and thanks for your help,

ZebraSerialPort is an object derived from serialport.Is implemented while using zebras sdk.


We do print via usb (imz320 connected with usb with a pc) by sending a file which contains zpl script to the printer.


Our issue is while trying to send same file via bluetooth connection.Our file is approx 90KB. We sent smaller file and worked.


Any ideas?

You can also find attached two prn files, ZPL1 prints fine ZPL2 no printing.

Vote up!
Vote down!

Points: 0

You voted ‘up’

Anonymous (not verified)
Hi Panicos, Sorry for the

Hi Panicos, Sorry for the delay in responding.

Bluetooth is a slow communication protocol and has interesting ways of handling flow control.  I recommend for larger files, to "chunk them up."

Starting with your code you have a byte[], so try sending only small amounts at a time. Don't worry about the delay to the printer, it can handle it.

Replace the line "port.Write(bytes, 0, nLength);" with something like below.  This will send 1000 bytes at a time.  You may have to adjust the sleep timing depending on the printer and other factors.  I broke it out so it was easy to see what was happening:

int chunk = 1000;

int lengthLeft = nLength;

int index = 0;

while (lengthLeft > 0)


    if (lengthLeft < chunk )

          chunk = lengthLeft;

    port.Write(bytes, index, chunk);

    index += chunk;

    lengthLeft -= chunk;




Vote up!
Vote down!

Points: 0

You voted ‘up’

Log in to post comments