我有一个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 …Run Code Online (Sandbox Code Playgroud) 我正在使用Motorola DS4208手持式条形码读取器。过去,我能够成功设置和使用此设备,但是最近它已停止工作。这可能是由于安装了其他设备也将OPOS和POS用于.Net接口的结果。
这是一个USB设备,因此我创建了一个名为* Moto_Scanner.xml *的控制配置文件,并将其放置在正确的位置。
<PointOfServiceConfig Version="1.0">
<ServiceObject Type="Scanner" Name="Example Scanner">
<HardwareId
From="HID\VID_05E0&PID_1300&REV_0100"
To="HID\VID_05E0&PID_1300&REV_0100" />
<HardwareId
From="HID\VID_05E0&PID_1300"
To="HID\VID_05E0&PID_1300" />
</ServiceObject>
</PointOfServiceConfig>
Run Code Online (Sandbox Code Playgroud)
使用SOMgr.exe,可以在POSDevices中看到具有正确路径的设备。然后,我创建了MotoScan的LogicalName。然后,它按预期出现在“逻辑名称”列表中。
使用Microsoft Point of Service \ SDK \ Samples \ Sample Application \ TestApp.exe,我可以打开并声明该设备的所有权。但是,尝试单击启用复选框后,我收到以下错误消息。
POSControlException ErrorCode(Failure) ExtendedErrorCode(0) occurred: Unable to enable the device. See inner exception for details.
System.ComponentModel.Win32Exception: The process cannot access the file because it is being used by another process
at Microsoft.PointOfService.ExampleServiceObjects.HidReader.HidThread.StartReading()
at Microsoft.PointOfService.ExampleServiceObjects.HidReader.OpenDevice()
at Microsoft.PointOfService.ExampleServiceObjects.ExampleScanner.set_DeviceEnabled(Boolean value)
Opened device: Example Scanner
Created …Run Code Online (Sandbox Code Playgroud) 我计划从头开发POS系统,它将基于Windows(目前是XP SP3).我试图了解用于使用POS设备的API.到目前为止,我发现OPOS是作为一组COM对象实现的,一个.Net库似乎是基于COM对象和一个名为UnifiedPOS的升级标准.
问题是,COM对象似乎已经很老了.Net 1.1之后的.Net内容还没有更新.但我无法找到UnifiedPOS规范的实现.
有人知道类似于Windows的UnifiedPOS SDK吗?或者有人可以推荐使用OPOS或任何其他API吗?
我经常搜索,我在这里找到了Posexplorer的例子,但我的打印机是usb,我读过PosExplorer用于并行.我不知道如何使用打印机进行打印以及如何将代码发送到打印机以打开抽屉.
我正在使用以下代码将转义序列发送到打印机:
string ESC = Convert.ToString((char)27);
string logo=Convert.ToString(ESC+"|tL");
_oposPrinter.PrintNormal(PrinterStation.Receipt, logo);
_oposPrinter.PrintNormal(PrinterStation.Receipt, "Print example\n");
_oposPrinter.PrintNormal(PrinterStation.Receipt, Convert.ToString((char)27 + "|#fP"));
Run Code Online (Sandbox Code Playgroud)
在调试并到达行时:
_oposPrinter.PrintNormal(PrinterStation.Receipt, logo);
Run Code Online (Sandbox Code Playgroud)
要么
_oposPrinter.PrintNormal(PrinterStation.Receipt, Convert.ToString((char)27 + "|#fP"));
Run Code Online (Sandbox Code Playgroud)
打印机不打印任何内容.