我编写了一个库,它根据一些用户输入创建位图图像。然后使用斑马打印机打印该位图。我遇到的问题是斑马打印机打印的图像上的所有内容都非常微弱和模糊,但如果我将位图打印到激光打印机,它看起来完全正常。有人以前遇到过这个问题吗?如果是的话,他们是如何解决的?我几乎尝试了所有我能想到的打印机设置。
更新了如何创建位图图像的代码。
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);
}
}
Zebra 打印驱动程序正在抖动您的输出。要为 Zebra 打印创建完美的图像,您需要以 203 DPI 和 2 色黑白(1 位)创建图像。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)