【问题标题】:create a manual configuration.xml file for a POS Printer using TCP/IP使用 TCP/IP 为 POS 打印机创建手动 configuration.xml 文件
【发布时间】: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()找到我的爱普生打印机

另外,如果我在这篇文章中出现任何代码格式错误,请见谅。

【问题讨论】:

    标签: c# xml printing tcp


    【解决方案1】:

    我不确定这是否会对您有所帮助。就我而言,我使用的是 JavaPOS 而不是 C#,并且我设法使用以太网 I/F 卡打印到我的 Epson 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 地址”而不是“ESDPRT001”。工作愉快!

    【讨论】:

    • 我曾尝试将 PortName 更改为 IP 地址,但没有成功,可能需要进行更多更改。感谢您的 xml,我将与我的交叉检查,因为我可能错过了一些东西。顺便说一句,您的打印机是直接/物理连接到您的计算机还是通过另一个路由器?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-19
    • 2021-03-05
    • 2019-12-24
    • 1970-01-01
    • 2012-07-19
    相关资源
    最近更新 更多