最近公司为了节约成本,原使用Zebra打印机打印标签,现在买了一个L-MARK的标签打印机,(10*L-MARK=1*zebra----10个L-MARK打印机等于一个zebra打印机的价格)!小弟遇到棘手的问题,用c#编写程序:1.首先从网上找到code39的字体后,下载到本机的字体库中;2.编写程序,进行打印,其中调用到这个字体。代码如下:
PrintDialog PD = new PrintDialog();
PrintDocument docToPrint = new PrintDocument();
//设置打印机开始打印的事件处理函数.函数原形如下:
public void StartPrint(Stream streamToPrint)
{
this.streamToPrint = streamToPrint;
docToPrint.PrintPage += new PrintPageEventHandler(docToPrint_PrintPage);
PD.AllowSomePages = true;
PD.ShowHelp = true;
PD.Document = docToPrint;
DialogResult result = PD.ShowDialog();
if (result == DialogResult.OK)
{
docToPrint.Print();
}
}public void docToPrint_PrintPage(object sender, PrintPageEventArgs e)
{
float yPos = 30;
float leftMargin = e.MarginBounds.Left;
text_1 = "*MB*"; //code39码前后都有星号
Font printFont = new Font("Arial", 10, FontStyle.Regular);
e.Graphics.DrawString(M, printFont, Brushes.Black, leftMargin - 100, yPos, new StringFormat());
e.Graphics.DrawString(B, printFont, Brushes.Black, leftMargin + 40, yPos, new StringFormat());
Font printFontBarCode = new Font("Free 3 of 9 Extended", 15, FontStyle.Regular);
e.Graphics.DrawString(text_1, printFontBarCode, Brushes.Black, leftMargin - 105, yPos + 20, new StringFormat());
} private void printbtn_Click(object sender, EventArgs e)
{
StartPrint(this.streamToPrint);
}
问题:1.条码可以打印出来,但是用扫描抢不能扫描出来!
尝试一下操作:
2.在记事本文件中输入:*MB* ,然后打印,则可以用扫描抢扫描出来!
3.在word中输入:*MB* ,然后打印,则也不能用扫描抢扫描出来!
不知道谁能解决这个问题,先谢谢了,分不够我会再加上的!!!
PrintDialog PD = new PrintDialog();
PrintDocument docToPrint = new PrintDocument();
//设置打印机开始打印的事件处理函数.函数原形如下:
public void StartPrint(Stream streamToPrint)
{
this.streamToPrint = streamToPrint;
docToPrint.PrintPage += new PrintPageEventHandler(docToPrint_PrintPage);
PD.AllowSomePages = true;
PD.ShowHelp = true;
PD.Document = docToPrint;
DialogResult result = PD.ShowDialog();
if (result == DialogResult.OK)
{
docToPrint.Print();
}
}public void docToPrint_PrintPage(object sender, PrintPageEventArgs e)
{
float yPos = 30;
float leftMargin = e.MarginBounds.Left;
text_1 = "*MB*"; //code39码前后都有星号
Font printFont = new Font("Arial", 10, FontStyle.Regular);
e.Graphics.DrawString(M, printFont, Brushes.Black, leftMargin - 100, yPos, new StringFormat());
e.Graphics.DrawString(B, printFont, Brushes.Black, leftMargin + 40, yPos, new StringFormat());
Font printFontBarCode = new Font("Free 3 of 9 Extended", 15, FontStyle.Regular);
e.Graphics.DrawString(text_1, printFontBarCode, Brushes.Black, leftMargin - 105, yPos + 20, new StringFormat());
} private void printbtn_Click(object sender, EventArgs e)
{
StartPrint(this.streamToPrint);
}
问题:1.条码可以打印出来,但是用扫描抢不能扫描出来!
尝试一下操作:
2.在记事本文件中输入:*MB* ,然后打印,则可以用扫描抢扫描出来!
3.在word中输入:*MB* ,然后打印,则也不能用扫描抢扫描出来!
不知道谁能解决这个问题,先谢谢了,分不够我会再加上的!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货