Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用TCP/IP为POS打印机创建手动configuration.xml文件_C#_Xml_Printing_Tcp - Fatal编程技术网

C# 使用TCP/IP为POS打印机创建手动configuration.xml文件

C# 使用TCP/IP为POS打印机创建手动configuration.xml文件,c#,xml,printing,tcp,C#,Xml,Printing,Tcp,我有2台爱普生TM-T81热敏打印机,1个USB,1个以太网端口。到目前为止,我一次只使用一台打印机 我已经构建了一个c代码,可以打印到特定的打印机上。现在我想有2台打印机与我的程序相关联。为此,我发现我需要在我的位置调整configuration.xml: C:\ProgramData\Microsoft\Point Of Service\Configuration\Configuration.xml 我现在知道需要做什么更改才能配置USB打印机。 但是我的以太网打印机将直接与我的无线路由器连

我有2台爱普生TM-T81热敏打印机,1个USB,1个以太网端口。到目前为止,我一次只使用一台打印机

我已经构建了一个c代码,可以打印到特定的打印机上。现在我想有2台打印机与我的程序相关联。为此,我发现我需要在我的位置调整configuration.xml:

C:\ProgramData\Microsoft\Point Of Service\Configuration\Configuration.xml

我现在知道需要做什么更改才能配置USB打印机。 但是我的以太网打印机将直接与我的无线路由器连接,无线路由器已经安装,但是没有更新configuration.xml

这是我的c代码


尝试
{
//创建PosExplorer
PosExplorer PosExplorer=新的PosExplorer();
DeviceInfo DeviceInfo=null;
字符串strLogicalName=“EpsonSale”;
尝试
{
deviceInfo=posExplorer.GetDevice(DeviceType.PosPrinter,strLogicalName);
m_Printer=(PosPrinter)posExplorer.CreateInstance(deviceInfo);
}
捕获(例外)
{
//ChangeButtonStatus();
返回;
}
//寄存器OutputCompleteEventHandler。
添加输出完成(m_打印机);
//打开设备
m_Printer.Open();
尝试
{
//获取已打开设备的独占控制权。
//然后从其他应用程序禁用该设备。
m_打印机索赔(1000);
控制台。WriteLine(“打印机索赔”);
}
捕获(例外e)
{
Console.WriteLine(“未声明打印机”);
}
//启用设备。
m_Printer.DeviceEnabled=真;
//--开始
//通过高质量模式输出
m_Printer.RecLetterQuality=true;
}
catch(异常){Console.WriteLine(“打印机初始化失败”);}

包含服务对象的My 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()


另外,如果我在这篇文章中出现了任何代码格式错误,我也很抱歉。

我不确定这是否对您有帮助。在我的例子中,我使用JavaPOS而不是C#,并使用以太网I/F卡将其打印到我的爱普生TMU220。下面看一下我的xml配置文件

<JposEntry logicalName="EpsonTMU220BEthernet">
    <creation factoryClass="jp.co.epson.uposcommon.util.EpsonJposServiceInstanceFactory" 
              serviceClass="jp.co.epson.upos.pntr.U220BService"/>
    <vendor name="SEIKO EPSON" url="http://www.epson.com"/>
    <jpos category="POSPrinter" version="1.11"/>
    <product description="EPSON TM-U220B Printer Device Service" 
             name="EPSON Services for JavaPOS(TM) Standard" 
             url="http://www.epson.com"/>

    <!--Other non JavaPOS required property 
    (mostly vendor properties and bus specific properties i.e. RS232 )-->
    <prop name="Halftone" type="String" value="0"/>
    <prop name="PhysicalPrinterName" type="String" value="TM-U220B"/>
    <prop name="NVRAMControlLevel" type="String" value="1"/>
    <prop name="Stamp" type="String" value="0"/>
    <prop name="OutputCompleteType" type="String" value="2"/>
    <prop name="StatusThreadInterval" type="String" value="500"/>
    <prop name="OutputTimeout" type="String" value="2000"/>
    <prop name="PortType" type="String" value="3"/>
    <prop name="OutputBufferSize" type="String" value="32768"/>
    <prop name="UsedNVRAM" type="String" value="0"/>
    <prop name="FirmRecordLog" type="String" value="1"/>
    <prop name="UdpRetryIntervalTime" type="String" value="50"/>
    <prop name="ReceiveTimeout" type="String" value="1000"/>
    <prop name="SlpReverseEject" type="String" value="0"/>
    <prop name="OfflineRetryIntervalTime" type="String" value="100"/>
    <prop name="PortName" type="String" value="192.168.12.192"/>
    <prop name="Upos.USB_Serial" type="String" value="false"/>
    <prop name="DefaultSlpClampTime" type="String" value="0"/>
    <prop name="epson.trace.file" type="String" value="trace.log"/>
    <prop name="AsyncProcessingSize" type="String" value="1"/>
    <prop name="KanjiTwoWaysPrint" type="String" value="0"/>
    <prop name="PulseStep" type="String" value="100"/>
    <prop name="PortInterfaceName" type="String" value="Ethernet"/>
    <prop name="U375Compatible" type="String" value="0"/>
    <prop name="preCutterFunction" type="String" value="0"/>
    <prop name="epson.tracing" type="String" value="false"/>
    <prop name="epson.trace.max.size" type="String" value="1000"/>
    <prop name="RecPaperSize" type="String" value="76"/>
    <prop name="DeviceDesc" type="String" 
          value="EPSON TM-U220B POSPrinter"/>
    <prop name="PageModeExt" type="String" value="0"/>
    <prop name="SupportStatistics" type="String" value="1"/>
    <prop name="FirmProgressRange" type="String" value="10"/>
    <prop name="OutputErrorOption" type="String" value="0"/>
    <prop name="UdpReceiveTimeout" type="String" value="1000"/>
    <prop name="SupportFirmware" type="String" value="0"/>
    <prop name="DeviceID" type="String" value="13"/>
    <prop name="InputTimeout" type="String" value="1000"/>
    <prop name="AutoPowerOff" type="String" value="0"/>
    <prop name="SlpMoreColumns" type="String" value="0"/>
    <prop name="RecPaperType" type="String" value="0"/>
    <prop name="MemorySwitch" type="String" value="0"/>
    <prop name="ReadThreadInterval" type="String" value="-1"/>
    <prop name="QueuingOfflineTimeout" type="String" value="1000"/>
    <prop name="InitializeThreadTime" type="String" value="1000"/>
    <prop name="TwoColor" type="String" value="1"/>
    <prop name="TwoByteCharacter" type="String" value="2"/>
    <prop name="UdpTransmitTimeout" type="String" value="1000"/>
    <prop name="FirmLogFileSize" type="String" value="1000"/>
    <prop name="Peeler" type="String" value="0"/>
    <prop name="ConfigurationFile" type="String" 
          value="epson/xml/Setting/TM-U220BSetting.xml"/>
    <prop name="Custom1Color" type="String" value="0xFF0000"/>
    <prop name="preEndorseFunction" type="String" value="0"/>
    <prop name="Upos.Spec_c" type="String" value="false"/>
    <prop name="UdpRetryCount" type="String" value="2"/>
    <prop name="FirmNotifyAllProgressEvents" type="String" value="0"/>
    <prop name="InitializeResponseTimeout" type="String" value="5000"/>
    <prop name="ReceiveRetryTime" type="String" value="25"/>
    <prop name="PrinterTransmitTimeout" type="String" value="30000"/>
    <prop name="RecMoreColumns" type="String" value="0"/>
    <prop name="UsedInterCharacterSet" type="String" value="0"/>
    <prop name="TcpPort" type="String" value="9100"/>
    <prop name="WriteThreadInterval" type="String" value="-1"/>
    <prop name="UdpPort" type="String" value="3289"/>
    <prop name="preORCBFunction" type="String" value="0"/>
    <prop name="RecNearEndSensor" type="String" value="0"/>
    <prop name="LogObject" type="String" value=""/>
    <prop name="Cutter" type="String" value="1"/>
    <prop name="PhysicalDevice" type="String" value="TM-U220B"/>
    <prop name="FirmLogFileName" type="String" value="Firmware.log"/>
    <prop name="UsedPeeler" type="String" value="0"/>
    <prop name="InputBufferSize" type="String" value="4096"/>
    <prop name="TransmitTimeout" type="String" value="5000"/>
    <prop name="EPurasSupport" type="String" value="TRUE"/>
    <prop name="OfflineCount" type="String" value="1"/>
    <prop name="TransmitRetryTime" type="String" value="100"/>
    <prop name="DirectIOEventTimeout" type="String" value="5000"/>
</JposEntry>  


我相信您需要更改一些值才能使其正常工作,例如:prop name=“PortName”将“打印机IP地址”更改为“打印机IP地址”,而不是“ESDPRT001”。工作愉快

我曾尝试将端口名更改为IP地址,但没有成功,可能需要进行更多更改。谢谢你的xml,我会和我的核对一下,因为我可能遗漏了一些东西。顺便问一下,您的打印机是直接/物理连接到您的计算机还是通过另一个路由器?
<JposEntry logicalName="EpsonTMU220BEthernet">
    <creation factoryClass="jp.co.epson.uposcommon.util.EpsonJposServiceInstanceFactory" 
              serviceClass="jp.co.epson.upos.pntr.U220BService"/>
    <vendor name="SEIKO EPSON" url="http://www.epson.com"/>
    <jpos category="POSPrinter" version="1.11"/>
    <product description="EPSON TM-U220B Printer Device Service" 
             name="EPSON Services for JavaPOS(TM) Standard" 
             url="http://www.epson.com"/>

    <!--Other non JavaPOS required property 
    (mostly vendor properties and bus specific properties i.e. RS232 )-->
    <prop name="Halftone" type="String" value="0"/>
    <prop name="PhysicalPrinterName" type="String" value="TM-U220B"/>
    <prop name="NVRAMControlLevel" type="String" value="1"/>
    <prop name="Stamp" type="String" value="0"/>
    <prop name="OutputCompleteType" type="String" value="2"/>
    <prop name="StatusThreadInterval" type="String" value="500"/>
    <prop name="OutputTimeout" type="String" value="2000"/>
    <prop name="PortType" type="String" value="3"/>
    <prop name="OutputBufferSize" type="String" value="32768"/>
    <prop name="UsedNVRAM" type="String" value="0"/>
    <prop name="FirmRecordLog" type="String" value="1"/>
    <prop name="UdpRetryIntervalTime" type="String" value="50"/>
    <prop name="ReceiveTimeout" type="String" value="1000"/>
    <prop name="SlpReverseEject" type="String" value="0"/>
    <prop name="OfflineRetryIntervalTime" type="String" value="100"/>
    <prop name="PortName" type="String" value="192.168.12.192"/>
    <prop name="Upos.USB_Serial" type="String" value="false"/>
    <prop name="DefaultSlpClampTime" type="String" value="0"/>
    <prop name="epson.trace.file" type="String" value="trace.log"/>
    <prop name="AsyncProcessingSize" type="String" value="1"/>
    <prop name="KanjiTwoWaysPrint" type="String" value="0"/>
    <prop name="PulseStep" type="String" value="100"/>
    <prop name="PortInterfaceName" type="String" value="Ethernet"/>
    <prop name="U375Compatible" type="String" value="0"/>
    <prop name="preCutterFunction" type="String" value="0"/>
    <prop name="epson.tracing" type="String" value="false"/>
    <prop name="epson.trace.max.size" type="String" value="1000"/>
    <prop name="RecPaperSize" type="String" value="76"/>
    <prop name="DeviceDesc" type="String" 
          value="EPSON TM-U220B POSPrinter"/>
    <prop name="PageModeExt" type="String" value="0"/>
    <prop name="SupportStatistics" type="String" value="1"/>
    <prop name="FirmProgressRange" type="String" value="10"/>
    <prop name="OutputErrorOption" type="String" value="0"/>
    <prop name="UdpReceiveTimeout" type="String" value="1000"/>
    <prop name="SupportFirmware" type="String" value="0"/>
    <prop name="DeviceID" type="String" value="13"/>
    <prop name="InputTimeout" type="String" value="1000"/>
    <prop name="AutoPowerOff" type="String" value="0"/>
    <prop name="SlpMoreColumns" type="String" value="0"/>
    <prop name="RecPaperType" type="String" value="0"/>
    <prop name="MemorySwitch" type="String" value="0"/>
    <prop name="ReadThreadInterval" type="String" value="-1"/>
    <prop name="QueuingOfflineTimeout" type="String" value="1000"/>
    <prop name="InitializeThreadTime" type="String" value="1000"/>
    <prop name="TwoColor" type="String" value="1"/>
    <prop name="TwoByteCharacter" type="String" value="2"/>
    <prop name="UdpTransmitTimeout" type="String" value="1000"/>
    <prop name="FirmLogFileSize" type="String" value="1000"/>
    <prop name="Peeler" type="String" value="0"/>
    <prop name="ConfigurationFile" type="String" 
          value="epson/xml/Setting/TM-U220BSetting.xml"/>
    <prop name="Custom1Color" type="String" value="0xFF0000"/>
    <prop name="preEndorseFunction" type="String" value="0"/>
    <prop name="Upos.Spec_c" type="String" value="false"/>
    <prop name="UdpRetryCount" type="String" value="2"/>
    <prop name="FirmNotifyAllProgressEvents" type="String" value="0"/>
    <prop name="InitializeResponseTimeout" type="String" value="5000"/>
    <prop name="ReceiveRetryTime" type="String" value="25"/>
    <prop name="PrinterTransmitTimeout" type="String" value="30000"/>
    <prop name="RecMoreColumns" type="String" value="0"/>
    <prop name="UsedInterCharacterSet" type="String" value="0"/>
    <prop name="TcpPort" type="String" value="9100"/>
    <prop name="WriteThreadInterval" type="String" value="-1"/>
    <prop name="UdpPort" type="String" value="3289"/>
    <prop name="preORCBFunction" type="String" value="0"/>
    <prop name="RecNearEndSensor" type="String" value="0"/>
    <prop name="LogObject" type="String" value=""/>
    <prop name="Cutter" type="String" value="1"/>
    <prop name="PhysicalDevice" type="String" value="TM-U220B"/>
    <prop name="FirmLogFileName" type="String" value="Firmware.log"/>
    <prop name="UsedPeeler" type="String" value="0"/>
    <prop name="InputBufferSize" type="String" value="4096"/>
    <prop name="TransmitTimeout" type="String" value="5000"/>
    <prop name="EPurasSupport" type="String" value="TRUE"/>
    <prop name="OfflineCount" type="String" value="1"/>
    <prop name="TransmitRetryTime" type="String" value="100"/>
    <prop name="DirectIOEventTimeout" type="String" value="5000"/>
</JposEntry>