Printing to Zebra printer gives faint and blurry images

Nathan picture Nathan · Apr 14, 2010 · Viewed 8.7k times · Source

I wrote a library which creates a bitmap image from some user input. This bitmap is then printed using a zebra printer. The problem I am running into is everything is very faint and blurry on the image printed by the zebra printer but if I print the bitmap to a laser printer it looks perfectly normal. Has anyone run into this before and if so how did they fix it? I have tried nearly everything I can think of printer settings wise.

Updated with code for how I create the bitmap images.

public static Bitmap GenerateLabel<T>(T obj, XmlDocument template)
    {
        try
        {
            int width = Convert.ToInt32(template.SelectSingleNode("/LABELS/@width").Value);
            int height = Convert.ToInt32(template.SelectSingleNode("/LABELS/@height").Value);

            if (obj == null || height <= 0 || width <= 0)
                throw new ArgumentException("Nothing to print");

            Bitmap bLabel = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(bLabel);

            XmlNodeList fieldList = template.SelectNodes("/LABELS/LABEL");

            foreach (XmlNode fieldDetails in fieldList)
            {
                //non important code...

                    g.DrawImage(bBarCode, field.Left, field.Top);


                using (TextBox txtbox = new TextBox())
                {
                    // more non important code...

                    Rectangle r = new Rectangle(field.Left, field.Top, field.Width, field.Height);
                    txtbox.DrawToBitmap(bLabel, r);
                }
            }

            return bLabel;
        }
        catch (Exception ex)
        {
            throw new Exception("Unable to create bitmap: " + ex.Message);
        }
    }

Answer

Mark Ransom picture Mark Ransom · Apr 23, 2010

The Zebra print driver is dithering your output. To create a perfect image for Zebra printing, you'll need to create an image at 203 DPI and 2-color black and white (1-bit).