【发布时间】:2013-12-07 12:06:37
【问题描述】:
我有 2 台 Epson TM-T81 热敏打印机、1 个 USB、1 个以太网端口。到目前为止,我一次只使用一台打印机。
我已经构建了一个打印到特定打印机的 c# 代码。现在我想让 2 台打印机与我的程序相关联。为此,我发现我需要在我的位置调整 configuration.xml:
C:\ProgramData\Microsoft\Point Of Service\Configuration\configuration.xml
我现在需要进行哪些更改才能配置 USB 打印机。 但是我的以太网打印机将直接与我的无线路由器连接,无线路由器已经安装,但没有更新 configuration.xml。
这是我的 C# 代码
<code>
try
{
//Create PosExplorer
PosExplorer posExplorer = new PosExplorer();
DeviceInfo deviceInfo = null;
String strLogicalName="EpsonSale";
try
{
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
}
catch (Exception)
{
//ChangeButtonStatus();
return;
}
//Register OutputCompleteEventHandler.
AddOutputComplete(m_Printer);
//Open the device
m_Printer.Open();
try
{
//Get the exclusive control right for the opened device.
//Then the device is disable from other application.
m_Printer.Claim(1000);
Console.WriteLine("Printer claimed");
}
catch (Exception e)
{
Console.WriteLine("Printer Not claimed");
}
//Enable the device.
m_Printer.DeviceEnabled = true;
//<<<step3>>>--Start
//Output by the high quality mode
m_Printer.RecLetterQuality = true;
}
catch(Exception){ Console.WriteLine("Printer Initialization failed.");}
我的 configuration.xml 文件包含服务对象:
<code>
<?xml version="1.0"?>
<PointOfServiceConfig Version="1.0">
<ServiceObject Type="PosPrinter" Name="TM-T81_203">
<Device HardwarePath="ESDPRT001">
<LogicalName Name="EpsonSale" />
<Property Name="AsyncProcessingSize" Value="2" />
<Property Name="AutoPowerOff" Value="0" />
<Property Name="ConfigurationFile" Value="epson/xml/Setting/TM-T81_203Setting.xml" />
<Property Name="Custom1Color" Value="0" />
<Property Name="Cutter" Value="1" />
<Property Name="DefaultCodePage" Value="997" />
<Property Name="DefaultSlpClampTime" Value="0" />
<Property Name="DeviceDesc" Value="EPSON TM-T81 POSPrinter" />
<Property Name="DirectIOEventTimeout" Value="5000" />
<Property Name="epson.trace.file" Value="trace.log" />
<Property Name="epson.trace.max.size" Value="1000" />
<Property Name="epson.tracing" Value="false" />
<Property Name="EPurasSupport" Value="TRUE" />
<Property Name="FirmLogFileName" Value="Firmware.log" />
<Property Name="FirmLogFileSize" Value="1000" />
<Property Name="FirmNotifyAllProgressEvents" Value="0" />
<Property Name="FirmProgressRange" Value="10" />
<Property Name="FirmRecordLog" Value="1" />
<Property Name="Halftone" Value="0" />
<Property Name="InitializeResponseTimeout" Value="5000" />
<Property Name="InitializeThreadTime" Value="1000" />
<Property Name="InputBufferSize" Value="4096" />
<Property Name="InputTimeout" Value="1000" />
<Property Name="KanjiTwoWaysPrint" Value="0" />
<Property Name="LogicalName" Value="EpsonSale" />
<Property Name="LogicalPortInterfaceName" Value="EPuras" />
<Property Name="LogicalPortName" Value="pipe://TM/ESDPRT001" />
<Property Name="LogObject" Value="" />
<Property Name="MemorySwitch" Value="0" />
<Property Name="NVRAMControlLevel" Value="1" />
<Property Name="OfflineCount" Value="1" />
<Property Name="OfflineRetryIntervalTime" Value="100" />
<Property Name="OutputBufferSize" Value="32768" />
<Property Name="OutputCompleteType" Value="2" />
<Property Name="OutputErrorOption" Value="0" />
<Property Name="OutputTimeout" Value="2000" />
<Property Name="PageModeExt" Value="0" />
<Property Name="Peeler" Value="0" />
<Property Name="PhysicalDevice" Value="TM-T81_203" />
<Property Name="PhysicalPrinterName" Value="TM-T81_203" />
<Property Name="PortInterfaceName" Value="USB" />
<Property Name="PortName" Value="ESDPRT001" />
<Property Name="PortType" Value="3" />
<Property Name="PrinterTransmitTimeout" Value="30000" />
<Property Name="QueuingOfflineTimeout" Value="1000" />
<Property Name="ReadThreadInterval" Value="-1" />
<Property Name="RecCharactersPerLine" Value="48" />
<Property Name="ReceiveRetryTime" Value="25" />
<Property Name="ReceiveTimeout" Value="1000" />
<Property Name="RecLineSpacing" Value="30" />
<Property Name="RecMoreColumns" Value="0" />
<Property Name="RecNearEndSensor" Value="1" />
<Property Name="RecPaperType" Value="0" />
<Property Name="SlpMoreColumns" Value="0" />
<Property Name="SlpReverseEject" Value="0" />
<Property Name="Stamp" Value="0" />
<Property Name="StatusThreadInterval" Value="500" />
<Property Name="SupportFirmware" Value="0" />
<Property Name="SupportStatistics" Value="1" />
<Property Name="TcpPort" Value="9100" />
<Property Name="TransmitRetryTime" Value="100" />
<Property Name="TransmitTimeout" Value="5000" />
<Property Name="TwoByteCharacter" Value="5" />
<Property Name="TwoColor" Value="0" />
<Property Name="U375Compatible" Value="0" />
<Property Name="UdpPort" Value="3289" />
<Property Name="UdpReceiveTimeout" Value="1000" />
<Property Name="UdpRetryCount" Value="2" />
<Property Name="UdpRetryIntervalTime" Value="50" />
<Property Name="UdpTransmitTimeout" Value="1000" />
<Property Name="Upos.Spec_c" Value="false" />
<Property Name="Upos.USB_Serial" Value="false" />
<Property Name="UsedInterCharacterSet" Value="0" />
<Property Name="UsedNVRAM" Value="0" />
<Property Name="UsedPeeler" Value="0" />
<Property Name="WriteThreadInterval" Value="-1" />
</Device>
</ServiceObject>
</PointOfServiceConfig>
</code>
USB 打印机正确声明了这台打印机,但是如何为我的 TCP/IP 端口打印机添加服务对象?我在某处读到可以直接将 serviceObject 添加到此文件,但是我的属性是什么?此外,我使用的是 TCP/IP 端口,而不是“ESDPRT10xx”端口。
我什至尝试了 Sean Liming 的一个程序 - SOMgr.exe 来创建服务对象,但找不到它有用。
我无法使用posExplorer.GetDevice()找到我的爱普生打印机
另外,如果我在这篇文章中出现任何代码格式错误,请见谅。
【问题讨论】: