Ama*_*aud 7 c# printing epson pos-for-.net
我有一个Epson TM-U220A,我正在编写和c#桌面应用程序打印收据.但它无法找到打印机.
如果我通过记事本发送东西(因此它的工作),打印机打印奇怪的字符
我有以下内容:
码:
private void FormLoad(object sender, System.EventArgs e)
{
//<<<step1>>>--Start
//Use a Logical Device Name which has been set on the SetupPOS.
string strLogicalName = "PosPrinter";
// string strLogicalName = "ESDPRT001";
try
{
//Create PosExplorer
PosExplorer posExplorer = new PosExplorer();
DeviceInfo deviceInfo = null;
try
{
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
}
catch (Exception)
{
ChangeButtonStatus();
return;
}
//Open the device
m_Printer.Open();
//Get the exclusive control right for the opened device.
//Then the device is disable from other application.
m_Printer.Claim(1000);
//Enable the device.
m_Printer.DeviceEnabled = true;
}
catch (PosControlException)
{
ChangeButtonStatus();
}
//<<<step1>>>--End
}
Run Code Online (Sandbox Code Playgroud)
错误:端口名称非法,或无法连接到设备.在线:m_Printer.Claim(1000);

根据我使用安装了 Windows 打印机驱动程序的 Epson POS 打印机的经验,会阻止以任何其他方式使用打印机。
我认为您应该尝试的第一件事是删除打印机,在 SetupPOS 中重新设置它,然后再次尝试您的程序。
祝你好运!
| 归档时间: |
|
| 查看次数: |
5870 次 |
| 最近记录: |