打印到Zebra打印机会产生模糊的图像

Nat*_*han 3 c# printing image bitmap zebra-printers

我写了一个库,它从一些用户输入创建一个位图图像.然后使用斑马打印机打印该位图.我遇到的问题是斑马打印机打印的图像上的一切都非常微弱和模糊,但如果我将位图打印到激光打印机,它看起来很正常.有没有人遇到这个,如果是这样,他们是如何解决它的?我已经尝试了几乎所有我能想到的打印机设置.

更新了我如何创建位图图像的代码.

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);
        }
    }
Run Code Online (Sandbox Code Playgroud)

Mar*_*som 5

Zebra打印驱动程序使输出抖动.要为Zebra打印创建完美图像,您需要创建203 DPI和2色黑白(1位)的图像.