开发的软件调用打印,使用硬字库模式,打印出来的字符是乱码(使用其他品牌打印机正常),
如果使用图形模式,可以正常打印,但打印速度非常慢。
使用C#开发,代码如下private void button5_Click(object sender, EventArgs e)
{
//变量 要打印的信息 string 类型
line += "123456\n\n";
line += "测试打印用 \n\n";
//设置打印机名称 变量
printDocument1.PrinterSettings.PrinterName = 登陆验证.PrintName;
printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
printDocument1.Print();
}
//打印事件 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
try
{
PointF abc = new PointF();
abc.X = Convert.ToInt32(登陆验证.LeftL);
abc.Y = Convert.ToInt32(登陆验证.UpL);
//字体大小
float size = (float)Convert.ToDouble(fontsize);
//字体 测试过宋体 ,Fixedsys,Arial 等几种字体均不行
System.Drawing.Font printFont = new System.Drawing.Font("宋体", size, System.Drawing.FontStyle.Regular);
e.Graphics.DrawString(line, printFont, System.Drawing.Brushes.Black, abc);
line = "";
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}有没有人遇到同样的问题,求高人指教
如果使用图形模式,可以正常打印,但打印速度非常慢。
使用C#开发,代码如下private void button5_Click(object sender, EventArgs e)
{
//变量 要打印的信息 string 类型
line += "123456\n\n";
line += "测试打印用 \n\n";
//设置打印机名称 变量
printDocument1.PrinterSettings.PrinterName = 登陆验证.PrintName;
printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
printDocument1.Print();
}
//打印事件 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
try
{
PointF abc = new PointF();
abc.X = Convert.ToInt32(登陆验证.LeftL);
abc.Y = Convert.ToInt32(登陆验证.UpL);
//字体大小
float size = (float)Convert.ToDouble(fontsize);
//字体 测试过宋体 ,Fixedsys,Arial 等几种字体均不行
System.Drawing.Font printFont = new System.Drawing.Font("宋体", size, System.Drawing.FontStyle.Regular);
e.Graphics.DrawString(line, printFont, System.Drawing.Brushes.Black, abc);
line = "";
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}有没有人遇到同样的问题,求高人指教
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货