有做过这个的请解答下,最好给demo。100分,马上结贴
33 个解决方案
#1
学习 帮你顶下
#2
没用过。
关注。
关注。
#3
#4
机器应该附带有软件的吧?
如果有附带软件,那就装上看看了.
或者参考使用说明书,先看看说明书了.
如果有附带软件,那就装上看看了.
或者参考使用说明书,先看看说明书了.
#5
顶起来,看看还有人知道吗
#6
我是用ITextSharp控件打印条码的:
string strBarCode = "0123456789123";
string strDescription = "Description";
if (strArgument == "1")
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode = cmbStock.SelectedItem.Text.ToString();
strDescription = cmbStock.SelectedItem.Value.ToString();
}
}
else
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode =cmbEmployee.SelectedItem.Text.ToString();
strDescription = cmbEmployee.SelectedItem.Value.ToString();
}
}
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(newpdf, FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
iTextSharp.text.Image imageTxt = null;
//BarcodeEAN
//BarcodePDF417
Barcode barcode = null;
switch (strBarCodeType )
{
//case "Codabar":
// //BarcodeCodabar codabar = new BarcodeCodabar();
// //codabar.Code = strBarCode;
// //codabar.StartStopText = false;
// //imageTxt = codabar.CreateImageWithBarcode(cb, null, null);
// barcode = new BarcodeCodabar();
// break;
case "Code128":
barcode=new Barcode128();
break;
case "Code39":
barcode=new Barcode39();
break;
case "Code39Extended":
barcode=new Barcode39();
barcode.Extended=true;
break;
case "EAN128":
barcode = new Barcode128();
barcode.CodeType = BarcodeEAN.CODE128_UCC;
break;
case "EAN13":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN13;
break;
case "EAN8":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN8;
break;
//case "PDF417":
// BarcodePDF417 pdf417 = new BarcodePDF417();
// pdf417.Code = strBarCode;
// pdf417.StartStopText = false;
// imageTxt = pdf417.CreateImageWithBarcode(cb, null, null);
// break;
}
barcode.Code = strBarCode;
//barcode.StartStopText = false;
imageTxt = barcode.CreateImageWithBarcode(cb, null, null);
//image39.SetAbsolutePosition(10, 10);
imageTxt.ScaleAbsoluteWidth(dblBarCodeWidth );
imageTxt.ScaleAbsoluteHeight(dblBarCodeHeight );
document.NewPage();
Font font = new Font(1, 9);
document.NewPage();
PdfPTable table = new PdfPTable(1);
table.WidthPercentage = 100;
table.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
table.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
//table.DefaultCell.FixedHeight = 20;
// table.AddCell("CODE 39");
table.AddCell(new Phrase(new Chunk(imageTxt, 0, 0)));
table.AddCell(new Phrase(strDescription , font));
document.Add(table);
string strBarCode = "0123456789123";
string strDescription = "Description";
if (strArgument == "1")
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode = cmbStock.SelectedItem.Text.ToString();
strDescription = cmbStock.SelectedItem.Value.ToString();
}
}
else
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode =cmbEmployee.SelectedItem.Text.ToString();
strDescription = cmbEmployee.SelectedItem.Value.ToString();
}
}
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(newpdf, FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
iTextSharp.text.Image imageTxt = null;
//BarcodeEAN
//BarcodePDF417
Barcode barcode = null;
switch (strBarCodeType )
{
//case "Codabar":
// //BarcodeCodabar codabar = new BarcodeCodabar();
// //codabar.Code = strBarCode;
// //codabar.StartStopText = false;
// //imageTxt = codabar.CreateImageWithBarcode(cb, null, null);
// barcode = new BarcodeCodabar();
// break;
case "Code128":
barcode=new Barcode128();
break;
case "Code39":
barcode=new Barcode39();
break;
case "Code39Extended":
barcode=new Barcode39();
barcode.Extended=true;
break;
case "EAN128":
barcode = new Barcode128();
barcode.CodeType = BarcodeEAN.CODE128_UCC;
break;
case "EAN13":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN13;
break;
case "EAN8":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN8;
break;
//case "PDF417":
// BarcodePDF417 pdf417 = new BarcodePDF417();
// pdf417.Code = strBarCode;
// pdf417.StartStopText = false;
// imageTxt = pdf417.CreateImageWithBarcode(cb, null, null);
// break;
}
barcode.Code = strBarCode;
//barcode.StartStopText = false;
imageTxt = barcode.CreateImageWithBarcode(cb, null, null);
//image39.SetAbsolutePosition(10, 10);
imageTxt.ScaleAbsoluteWidth(dblBarCodeWidth );
imageTxt.ScaleAbsoluteHeight(dblBarCodeHeight );
document.NewPage();
Font font = new Font(1, 9);
document.NewPage();
PdfPTable table = new PdfPTable(1);
table.WidthPercentage = 100;
table.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
table.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
//table.DefaultCell.FixedHeight = 20;
// table.AddCell("CODE 39");
table.AddCell(new Phrase(new Chunk(imageTxt, 0, 0)));
table.AddCell(new Phrase(strDescription , font));
document.Add(table);
#7
1、联系打印机厂家,获取c或c++的编程手册;
2、将控制代码封装成dll;
3、webform中引用dll,注册到客户端
2、将控制代码封装成dll;
3、webform中引用dll,注册到客户端
#8
帮顶下
#9
这个只能定下
#10
什么说明都没有的话那怎么可能弄呐。
我搜的斑马打印机 888-tt :
提供WIN9X、NT、2000打印驱动
LAN/Ethernet via EPL PrintServer 可选
独特简便的EPC2编程语言
这个打印机要activex控件驱动的
我搜的斑马打印机 888-tt :
提供WIN9X、NT、2000打印驱动
LAN/Ethernet via EPL PrintServer 可选
独特简便的EPC2编程语言
这个打印机要activex控件驱动的
#11
这是别人的一个斑马打印机 示例,不过是别的型号,activex控件在:
http://download.csdn.net/down/1947669/crazykiller
protected void btnprint_Click(object sender, EventArgs e)
{
//先打开端口
long r = CallOutPrint.PortOpen(5, 19200);
RecordLog.writeFile(LogTypeEnum.Search, "打开端口:" + r.ToString());
//System.Web.HttpContext.Current.Server.MapPath(),
if (r == 0)
{
//设置坐标原点
int rset = CallOutPrint.SetPrintXY(0, 0);
////设置打印机每次打印是否都要回退函数
//CallOutPrint.SetPrintBack(CStrTolong(txtisback.Text));
////设置打印机打印黑度函数
//CallOutPrint.SetDarkness(CStrTolong(txtdark.Text));
////设置打印机的打印速率函数
//CallOutPrint.SetPrintSpeed(CStrTolong(txtspeed.Text));
//设置打印机打印每张标签完后的吐纸尺寸函数
//CallOutPrint.SetPrintFeedDim(CStrTolong(txtfeeddim.Text));
//初始化打印机,即可设置打印机黑度,打印速率,出纸模式函数
//CallOutPrint.SetInitialize(CStrTolong(txtspeed.Text), CStrTolong(txtdark.Text), CStrTolong(txtisback.Text));
//设置标签纸的尺寸函数
CallOutPrint.SetPaperSize(0, 100, 30, 2);
//输出中文
StringBuilder strc = new StringBuilder();
strc.Append("姓名:李三 性别:男 科室:J1");
int rc = CallOutPrint.PrintChineseStr(25, 16, 0,0, 2, 0, strc);
RecordLog.writeFile(LogTypeEnum.Search, "打中文字符:" + rc.ToString());
//输出条码
StringBuilder str = new StringBuilder();
str.Append(txtbar.Text);
int rb = CallOutPrint.PrintBarcode(25, 4, 0, 1, 3, 12, 60, 1, str);
RecordLog.writeFile(LogTypeEnum.Search, "打条码:" + rb.ToString());
int rp = CallOutPrint.Print(1);
}
int rclear = CallOutPrint.SetClear();
//关闭端口
int rclose = CallOutPrint.PortClose();
RecordLog.writeFile(LogTypeEnum.Search, "关闭端口:" + rclose.ToString());
}
#13
这个要供应商给接口就可以了啊,在程序中引用DLL就OK了撒
#14
顶起来,看看还有好主意吗
#15
用web打印啊。
#16
非诚勿扰,谢谢
#17
刚好我也在用,以前坐过,我们用的是斑马EPL888-TT
#18
有专门的控制命令,直接输出到LPT或USB口就可以。有需要可以给你发邮箱。
#19
/// <summary>
/// 条码打印类
/// </summary>
public class PrintBar
{
/// <summary>
/// 并口号
/// </summary>
private string LptStr = "LPT1";
private string strh = "Q192";
private string strj = "16";
enum MyFontSize
{
Size16,
Size19
}
#region 构造函数
public PrintBar(string LPT_Str)
{
//
//EPL语言打印条码类
//
LptStr = LPT_Str;
}
public PrintBar()
{
//
//EPL语言打印条码类
//
LptStr = "LPT1";
}
#endregion
#region 调用API函数
[StructLayout(LayoutKind.Sequential)]
private struct OVERLAPPED
{
int Internal;
int InternalHigh;
int Offset;
int OffSetHigh;
int hEvent;
}
[DllImport("kernel32.dll")]
private static extern int CreateFile(
string lpFileName,
uint dwDesiredAccess,
int dwShareMode,
int lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
int hTemplateFile
);
[DllImport("kernel32.dll")]
private static extern bool WriteFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToWrite,
ref int lpNumberOfBytesWritten,
ref OVERLAPPED lpOverlapped
);
[DllImport("kernel32.dll")]
private static extern bool CloseHandle(
int hObject
);
[DllImport("Eltronp.dll", CharSet = CharSet.Ansi)]
public static extern int PrintHZ(int Lpt, int x,int y,string HZBuf, string FontName,int FontSize,int FontStyle);
/*Lpt: 0 LPT1 1 LPT2
x: 横坐标(单位 dot)
y: 纵坐标(单位 dot)
HZBuf: 要打印的汉字信息
FontName: 字体名称
FontSize: 字体大小(打印时调整)
FontStyle: 0 //正常体
1 //粗体
2 //斜体
3 //带下划线
4 //粗斜体
5 //粗下划线
6 //粗斜体下划线
7 //斜体下划线
*/
#endregion
#region 打开关闭端口
private int Handle;
public bool Open()
{
Handle = CreateFile(LptStr, 0x40000000, 0, 0, 3, 0, 0);
if (Handle != -1)
{
return true;
}
else
{
return false;
}
}
public bool Write(String Mystring)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
byte[] mybyte = System.Text.Encoding.Default.GetBytes(Mystring);
bool b = WriteFile(Handle, mybyte, mybyte.Length, ref i, ref x);
return b;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Write(byte[] mybyte)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
WriteFile(Handle, mybyte, mybyte.Length,ref i, ref x);
return true;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Close()
{
return CloseHandle(Handle);
}
#endregion
/// 条码打印类
/// </summary>
public class PrintBar
{
/// <summary>
/// 并口号
/// </summary>
private string LptStr = "LPT1";
private string strh = "Q192";
private string strj = "16";
enum MyFontSize
{
Size16,
Size19
}
#region 构造函数
public PrintBar(string LPT_Str)
{
//
//EPL语言打印条码类
//
LptStr = LPT_Str;
}
public PrintBar()
{
//
//EPL语言打印条码类
//
LptStr = "LPT1";
}
#endregion
#region 调用API函数
[StructLayout(LayoutKind.Sequential)]
private struct OVERLAPPED
{
int Internal;
int InternalHigh;
int Offset;
int OffSetHigh;
int hEvent;
}
[DllImport("kernel32.dll")]
private static extern int CreateFile(
string lpFileName,
uint dwDesiredAccess,
int dwShareMode,
int lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
int hTemplateFile
);
[DllImport("kernel32.dll")]
private static extern bool WriteFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToWrite,
ref int lpNumberOfBytesWritten,
ref OVERLAPPED lpOverlapped
);
[DllImport("kernel32.dll")]
private static extern bool CloseHandle(
int hObject
);
[DllImport("Eltronp.dll", CharSet = CharSet.Ansi)]
public static extern int PrintHZ(int Lpt, int x,int y,string HZBuf, string FontName,int FontSize,int FontStyle);
/*Lpt: 0 LPT1 1 LPT2
x: 横坐标(单位 dot)
y: 纵坐标(单位 dot)
HZBuf: 要打印的汉字信息
FontName: 字体名称
FontSize: 字体大小(打印时调整)
FontStyle: 0 //正常体
1 //粗体
2 //斜体
3 //带下划线
4 //粗斜体
5 //粗下划线
6 //粗斜体下划线
7 //斜体下划线
*/
#endregion
#region 打开关闭端口
private int Handle;
public bool Open()
{
Handle = CreateFile(LptStr, 0x40000000, 0, 0, 3, 0, 0);
if (Handle != -1)
{
return true;
}
else
{
return false;
}
}
public bool Write(String Mystring)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
byte[] mybyte = System.Text.Encoding.Default.GetBytes(Mystring);
bool b = WriteFile(Handle, mybyte, mybyte.Length, ref i, ref x);
return b;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Write(byte[] mybyte)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
WriteFile(Handle, mybyte, mybyte.Length,ref i, ref x);
return true;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Close()
{
return CloseHandle(Handle);
}
#endregion
#20
楼上的大哥,谢谢啊,太感动了,加我qq吧, 415548110 太感谢了,我还有不太明白的,想问问您。
#21
我的解決方案(一直在用):
寫ZPLII指令(斑馬提供的機器指令,資料網上有下的),通過COM口發送到ZEBRA
但ZPLII指令很難寫,所以用BARONE5.0(ZEBRA出的),畫一個,然後導出成ZPLII指令,再通過COM或者LPT控制ZEBRA就行了.
寫ZPLII指令(斑馬提供的機器指令,資料網上有下的),通過COM口發送到ZEBRA
但ZPLII指令很難寫,所以用BARONE5.0(ZEBRA出的),畫一個,然後導出成ZPLII指令,再通過COM或者LPT控制ZEBRA就行了.
#22
看樣子,LZ好像對WM開發有些心得喔,
ZEBRA的條碼打印機我也有些心得,交流交流.
ZEBRA的條碼打印機我也有些心得,交流交流.
#23
888-tt 這個型號沒用過,不知道支不支持ZPLII.
#24
up
#25
查過了,能跟105PK,又有COM口,應該支持
以前也用過一個桌面型的,ZPLII也是可以的.
以前也用過一個桌面型的,ZPLII也是可以的.
#26
支持的是EPL
#27
支持ZPL
#28
斑马打印机也支持打pdf格式
你可以将条形码图片导入pdf,然后调用PDF的打印插件打印
你可以将条形码图片导入pdf,然后调用PDF的打印插件打印
#29
路过,来学习下
#30
我前几天做了一个条码打印,不过我们是 力象的
我是直接用Dll的
我是直接用Dll的
#31
学习了。。。。顶。。。
#32
#33
问题解决了,改结贴了,谢谢各位高手的赐教,等忙完这几天,我把条码打印,扫描用到的类和方法 写在我博客里供大家参考,在此感谢highfly2008兄弟的帮助。
#1
学习 帮你顶下
#2
没用过。
关注。
关注。
#3
http://hi.baidu.com/e_%D2%EC%B3%A3/blog/item/e2ae6758ed8083232934f058.html
http://blog.csdn.net/lfywy/archive/2008/05/16/2450710.aspx
给你2个参考,是控制打印机的
给你2个参考,是控制打印机的
#4
机器应该附带有软件的吧?
如果有附带软件,那就装上看看了.
或者参考使用说明书,先看看说明书了.
如果有附带软件,那就装上看看了.
或者参考使用说明书,先看看说明书了.
#5
顶起来,看看还有人知道吗
#6
我是用ITextSharp控件打印条码的:
string strBarCode = "0123456789123";
string strDescription = "Description";
if (strArgument == "1")
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode = cmbStock.SelectedItem.Text.ToString();
strDescription = cmbStock.SelectedItem.Value.ToString();
}
}
else
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode =cmbEmployee.SelectedItem.Text.ToString();
strDescription = cmbEmployee.SelectedItem.Value.ToString();
}
}
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(newpdf, FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
iTextSharp.text.Image imageTxt = null;
//BarcodeEAN
//BarcodePDF417
Barcode barcode = null;
switch (strBarCodeType )
{
//case "Codabar":
// //BarcodeCodabar codabar = new BarcodeCodabar();
// //codabar.Code = strBarCode;
// //codabar.StartStopText = false;
// //imageTxt = codabar.CreateImageWithBarcode(cb, null, null);
// barcode = new BarcodeCodabar();
// break;
case "Code128":
barcode=new Barcode128();
break;
case "Code39":
barcode=new Barcode39();
break;
case "Code39Extended":
barcode=new Barcode39();
barcode.Extended=true;
break;
case "EAN128":
barcode = new Barcode128();
barcode.CodeType = BarcodeEAN.CODE128_UCC;
break;
case "EAN13":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN13;
break;
case "EAN8":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN8;
break;
//case "PDF417":
// BarcodePDF417 pdf417 = new BarcodePDF417();
// pdf417.Code = strBarCode;
// pdf417.StartStopText = false;
// imageTxt = pdf417.CreateImageWithBarcode(cb, null, null);
// break;
}
barcode.Code = strBarCode;
//barcode.StartStopText = false;
imageTxt = barcode.CreateImageWithBarcode(cb, null, null);
//image39.SetAbsolutePosition(10, 10);
imageTxt.ScaleAbsoluteWidth(dblBarCodeWidth );
imageTxt.ScaleAbsoluteHeight(dblBarCodeHeight );
document.NewPage();
Font font = new Font(1, 9);
document.NewPage();
PdfPTable table = new PdfPTable(1);
table.WidthPercentage = 100;
table.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
table.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
//table.DefaultCell.FixedHeight = 20;
// table.AddCell("CODE 39");
table.AddCell(new Phrase(new Chunk(imageTxt, 0, 0)));
table.AddCell(new Phrase(strDescription , font));
document.Add(table);
string strBarCode = "0123456789123";
string strDescription = "Description";
if (strArgument == "1")
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode = cmbStock.SelectedItem.Text.ToString();
strDescription = cmbStock.SelectedItem.Value.ToString();
}
}
else
{
if (cmbStock.SelectedIndex >= 0)
{
strBarCode =cmbEmployee.SelectedItem.Text.ToString();
strDescription = cmbEmployee.SelectedItem.Value.ToString();
}
}
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(newpdf, FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
iTextSharp.text.Image imageTxt = null;
//BarcodeEAN
//BarcodePDF417
Barcode barcode = null;
switch (strBarCodeType )
{
//case "Codabar":
// //BarcodeCodabar codabar = new BarcodeCodabar();
// //codabar.Code = strBarCode;
// //codabar.StartStopText = false;
// //imageTxt = codabar.CreateImageWithBarcode(cb, null, null);
// barcode = new BarcodeCodabar();
// break;
case "Code128":
barcode=new Barcode128();
break;
case "Code39":
barcode=new Barcode39();
break;
case "Code39Extended":
barcode=new Barcode39();
barcode.Extended=true;
break;
case "EAN128":
barcode = new Barcode128();
barcode.CodeType = BarcodeEAN.CODE128_UCC;
break;
case "EAN13":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN13;
break;
case "EAN8":
barcode = new BarcodeEAN();
barcode.CodeType = BarcodeEAN.EAN8;
break;
//case "PDF417":
// BarcodePDF417 pdf417 = new BarcodePDF417();
// pdf417.Code = strBarCode;
// pdf417.StartStopText = false;
// imageTxt = pdf417.CreateImageWithBarcode(cb, null, null);
// break;
}
barcode.Code = strBarCode;
//barcode.StartStopText = false;
imageTxt = barcode.CreateImageWithBarcode(cb, null, null);
//image39.SetAbsolutePosition(10, 10);
imageTxt.ScaleAbsoluteWidth(dblBarCodeWidth );
imageTxt.ScaleAbsoluteHeight(dblBarCodeHeight );
document.NewPage();
Font font = new Font(1, 9);
document.NewPage();
PdfPTable table = new PdfPTable(1);
table.WidthPercentage = 100;
table.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
table.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
//table.DefaultCell.FixedHeight = 20;
// table.AddCell("CODE 39");
table.AddCell(new Phrase(new Chunk(imageTxt, 0, 0)));
table.AddCell(new Phrase(strDescription , font));
document.Add(table);
#7
1、联系打印机厂家,获取c或c++的编程手册;
2、将控制代码封装成dll;
3、webform中引用dll,注册到客户端
2、将控制代码封装成dll;
3、webform中引用dll,注册到客户端
#8
帮顶下
#9
这个只能定下
#10
什么说明都没有的话那怎么可能弄呐。
我搜的斑马打印机 888-tt :
提供WIN9X、NT、2000打印驱动
LAN/Ethernet via EPL PrintServer 可选
独特简便的EPC2编程语言
这个打印机要activex控件驱动的
我搜的斑马打印机 888-tt :
提供WIN9X、NT、2000打印驱动
LAN/Ethernet via EPL PrintServer 可选
独特简便的EPC2编程语言
这个打印机要activex控件驱动的
#11
这是别人的一个斑马打印机 示例,不过是别的型号,activex控件在:
http://download.csdn.net/down/1947669/crazykiller
protected void btnprint_Click(object sender, EventArgs e)
{
//先打开端口
long r = CallOutPrint.PortOpen(5, 19200);
RecordLog.writeFile(LogTypeEnum.Search, "打开端口:" + r.ToString());
//System.Web.HttpContext.Current.Server.MapPath(),
if (r == 0)
{
//设置坐标原点
int rset = CallOutPrint.SetPrintXY(0, 0);
////设置打印机每次打印是否都要回退函数
//CallOutPrint.SetPrintBack(CStrTolong(txtisback.Text));
////设置打印机打印黑度函数
//CallOutPrint.SetDarkness(CStrTolong(txtdark.Text));
////设置打印机的打印速率函数
//CallOutPrint.SetPrintSpeed(CStrTolong(txtspeed.Text));
//设置打印机打印每张标签完后的吐纸尺寸函数
//CallOutPrint.SetPrintFeedDim(CStrTolong(txtfeeddim.Text));
//初始化打印机,即可设置打印机黑度,打印速率,出纸模式函数
//CallOutPrint.SetInitialize(CStrTolong(txtspeed.Text), CStrTolong(txtdark.Text), CStrTolong(txtisback.Text));
//设置标签纸的尺寸函数
CallOutPrint.SetPaperSize(0, 100, 30, 2);
//输出中文
StringBuilder strc = new StringBuilder();
strc.Append("姓名:李三 性别:男 科室:J1");
int rc = CallOutPrint.PrintChineseStr(25, 16, 0,0, 2, 0, strc);
RecordLog.writeFile(LogTypeEnum.Search, "打中文字符:" + rc.ToString());
//输出条码
StringBuilder str = new StringBuilder();
str.Append(txtbar.Text);
int rb = CallOutPrint.PrintBarcode(25, 4, 0, 1, 3, 12, 60, 1, str);
RecordLog.writeFile(LogTypeEnum.Search, "打条码:" + rb.ToString());
int rp = CallOutPrint.Print(1);
}
int rclear = CallOutPrint.SetClear();
//关闭端口
int rclose = CallOutPrint.PortClose();
RecordLog.writeFile(LogTypeEnum.Search, "关闭端口:" + rclose.ToString());
}
#12
去卖家获取activex控件
http://mz15.xnwkj.com/Show_product.asp?id=27752
#13
这个要供应商给接口就可以了啊,在程序中引用DLL就OK了撒
#14
顶起来,看看还有好主意吗
#15
用web打印啊。
#16
非诚勿扰,谢谢
#17
刚好我也在用,以前坐过,我们用的是斑马EPL888-TT
#18
有专门的控制命令,直接输出到LPT或USB口就可以。有需要可以给你发邮箱。
#19
/// <summary>
/// 条码打印类
/// </summary>
public class PrintBar
{
/// <summary>
/// 并口号
/// </summary>
private string LptStr = "LPT1";
private string strh = "Q192";
private string strj = "16";
enum MyFontSize
{
Size16,
Size19
}
#region 构造函数
public PrintBar(string LPT_Str)
{
//
//EPL语言打印条码类
//
LptStr = LPT_Str;
}
public PrintBar()
{
//
//EPL语言打印条码类
//
LptStr = "LPT1";
}
#endregion
#region 调用API函数
[StructLayout(LayoutKind.Sequential)]
private struct OVERLAPPED
{
int Internal;
int InternalHigh;
int Offset;
int OffSetHigh;
int hEvent;
}
[DllImport("kernel32.dll")]
private static extern int CreateFile(
string lpFileName,
uint dwDesiredAccess,
int dwShareMode,
int lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
int hTemplateFile
);
[DllImport("kernel32.dll")]
private static extern bool WriteFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToWrite,
ref int lpNumberOfBytesWritten,
ref OVERLAPPED lpOverlapped
);
[DllImport("kernel32.dll")]
private static extern bool CloseHandle(
int hObject
);
[DllImport("Eltronp.dll", CharSet = CharSet.Ansi)]
public static extern int PrintHZ(int Lpt, int x,int y,string HZBuf, string FontName,int FontSize,int FontStyle);
/*Lpt: 0 LPT1 1 LPT2
x: 横坐标(单位 dot)
y: 纵坐标(单位 dot)
HZBuf: 要打印的汉字信息
FontName: 字体名称
FontSize: 字体大小(打印时调整)
FontStyle: 0 //正常体
1 //粗体
2 //斜体
3 //带下划线
4 //粗斜体
5 //粗下划线
6 //粗斜体下划线
7 //斜体下划线
*/
#endregion
#region 打开关闭端口
private int Handle;
public bool Open()
{
Handle = CreateFile(LptStr, 0x40000000, 0, 0, 3, 0, 0);
if (Handle != -1)
{
return true;
}
else
{
return false;
}
}
public bool Write(String Mystring)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
byte[] mybyte = System.Text.Encoding.Default.GetBytes(Mystring);
bool b = WriteFile(Handle, mybyte, mybyte.Length, ref i, ref x);
return b;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Write(byte[] mybyte)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
WriteFile(Handle, mybyte, mybyte.Length,ref i, ref x);
return true;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Close()
{
return CloseHandle(Handle);
}
#endregion
/// 条码打印类
/// </summary>
public class PrintBar
{
/// <summary>
/// 并口号
/// </summary>
private string LptStr = "LPT1";
private string strh = "Q192";
private string strj = "16";
enum MyFontSize
{
Size16,
Size19
}
#region 构造函数
public PrintBar(string LPT_Str)
{
//
//EPL语言打印条码类
//
LptStr = LPT_Str;
}
public PrintBar()
{
//
//EPL语言打印条码类
//
LptStr = "LPT1";
}
#endregion
#region 调用API函数
[StructLayout(LayoutKind.Sequential)]
private struct OVERLAPPED
{
int Internal;
int InternalHigh;
int Offset;
int OffSetHigh;
int hEvent;
}
[DllImport("kernel32.dll")]
private static extern int CreateFile(
string lpFileName,
uint dwDesiredAccess,
int dwShareMode,
int lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
int hTemplateFile
);
[DllImport("kernel32.dll")]
private static extern bool WriteFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToWrite,
ref int lpNumberOfBytesWritten,
ref OVERLAPPED lpOverlapped
);
[DllImport("kernel32.dll")]
private static extern bool CloseHandle(
int hObject
);
[DllImport("Eltronp.dll", CharSet = CharSet.Ansi)]
public static extern int PrintHZ(int Lpt, int x,int y,string HZBuf, string FontName,int FontSize,int FontStyle);
/*Lpt: 0 LPT1 1 LPT2
x: 横坐标(单位 dot)
y: 纵坐标(单位 dot)
HZBuf: 要打印的汉字信息
FontName: 字体名称
FontSize: 字体大小(打印时调整)
FontStyle: 0 //正常体
1 //粗体
2 //斜体
3 //带下划线
4 //粗斜体
5 //粗下划线
6 //粗斜体下划线
7 //斜体下划线
*/
#endregion
#region 打开关闭端口
private int Handle;
public bool Open()
{
Handle = CreateFile(LptStr, 0x40000000, 0, 0, 3, 0, 0);
if (Handle != -1)
{
return true;
}
else
{
return false;
}
}
public bool Write(String Mystring)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
byte[] mybyte = System.Text.Encoding.Default.GetBytes(Mystring);
bool b = WriteFile(Handle, mybyte, mybyte.Length, ref i, ref x);
return b;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Write(byte[] mybyte)
{
if (Handle != -1)
{
OVERLAPPED x = new OVERLAPPED();
int i = 0;
WriteFile(Handle, mybyte, mybyte.Length,ref i, ref x);
return true;
}
else
{
MessageBox.Show("不能连接到打印机!");
return false;
}
}
public bool Close()
{
return CloseHandle(Handle);
}
#endregion
#20
楼上的大哥,谢谢啊,太感动了,加我qq吧, 415548110 太感谢了,我还有不太明白的,想问问您。
#21
我的解決方案(一直在用):
寫ZPLII指令(斑馬提供的機器指令,資料網上有下的),通過COM口發送到ZEBRA
但ZPLII指令很難寫,所以用BARONE5.0(ZEBRA出的),畫一個,然後導出成ZPLII指令,再通過COM或者LPT控制ZEBRA就行了.
寫ZPLII指令(斑馬提供的機器指令,資料網上有下的),通過COM口發送到ZEBRA
但ZPLII指令很難寫,所以用BARONE5.0(ZEBRA出的),畫一個,然後導出成ZPLII指令,再通過COM或者LPT控制ZEBRA就行了.
#22
看樣子,LZ好像對WM開發有些心得喔,
ZEBRA的條碼打印機我也有些心得,交流交流.
ZEBRA的條碼打印機我也有些心得,交流交流.
#23
888-tt 這個型號沒用過,不知道支不支持ZPLII.
#24
up
#25
查過了,能跟105PK,又有COM口,應該支持
以前也用過一個桌面型的,ZPLII也是可以的.
以前也用過一個桌面型的,ZPLII也是可以的.
#26
支持的是EPL
#27
支持ZPL
#28
斑马打印机也支持打pdf格式
你可以将条形码图片导入pdf,然后调用PDF的打印插件打印
你可以将条形码图片导入pdf,然后调用PDF的打印插件打印
#29
路过,来学习下
#30
我前几天做了一个条码打印,不过我们是 力象的
我是直接用Dll的
我是直接用Dll的
#31
学习了。。。。顶。。。
#32
#33
问题解决了,改结贴了,谢谢各位高手的赐教,等忙完这几天,我把条码打印,扫描用到的类和方法 写在我博客里供大家参考,在此感谢highfly2008兄弟的帮助。