简体   繁体   English

JavaPOS 打印文本抛出 JposException

[英]JavaPOS printing text throws JposException

I had a lot trouble to setup a applet to work with an Epson TM-T88V pos printer.我在设置小程序以使用 Epson TM-T88V pos 打印机时遇到了很多麻烦。 Now I can send the command for the cutter and it works.现在我可以发送切割器的命令并且它起作用了。 But printing any other text is not possible.但是打印任何其他文本是不可能的。

The following jpos.JposException occurs:发生以下 jpos.JposException:

jpos.JposException: UnicodeDLL:-10An undefined parameter value was set.  
  at jp.co.epson.upos.T88V.pntr.T88VService.createNormalData(Unknown Source)  
  at jp.co.epson.upos.core.v1_13_0001.pntr.CommonPrinterService.executeNormalPrint(Unknown Source)  
  at jp.co.epson.upos.T88V.pntr.T88VService.printNormal(Unknown Source)  
  at jpos.POSPrinter.printNormal(Unknown Source)  
  at de.develman.pos.printer.Printer.printReceipt(Printer.java:58)  
  at de.develman.pos.ui.action.PrintAction.actionPerformed(PrintAction.java:22)  
  at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)  
  ...

My code looks as follows:我的代码如下所示:

private void initPrinter() throws JposException {
    ptr.open("POSPrinter");
    ptr.claim(1000);
    ptr.setDeviceEnabled(true);
    ptr.setMapMode(POSPrinterConst.PTR_MM_METRIC);
}

private boolean printerUseable() throws JposException {
    // check if the cover is open
if (ptr.getCoverOpen() == true) {
    // cover open so do not attempt printing
    System.out.println("printer.getCoverOpen() == true");
    return false;
}

// check if the printer is out of paper
if (ptr.getRecEmpty() == true) {
    // the printer is out of paper so do not attempt printing
    System.out.println("printer.getRecEmpty() == true");
    return false;
}

    return true;
}

public void printReceipt() {
    try {
        initPrinter();
        if (printerUseable()) {
            ptr.printNormal(POSPrinterConst.PTR_S_RECEIPT, "1\n");
            ptr.printNormal(POSPrinterConst.PTR_S_RECEIPT, PAPERCUT);
        }
    } catch (JposException e) {
        // display any errors that come up
        e.printStackTrace();
    } finally {
        // close the printer object
        try {
            ptr.setDeviceEnabled(false);
            ptr.release();
            ptr.close();
        } catch (Exception e) {
    }
}

The exceptions points to the line:异常指向该行:

ptr.printNormal(POSPrinterConst.PTR_S_RECEIPT, "1\n");

If I run the code from eclipse everything works fine.如果我从 eclipse 运行代码,一切正常。 If I remove the line, the cutter works fine.如果我删除线,切割机工作正常。 But if I want to print any text, the given exception is thrown.但是如果我想打印任何文本,就会抛出给定的异常。
What is my problem here?我这里有什么问题?

I have implemented JavaPOS with an Epson TM-T88V printer and I had the same error, but I was able to resolve the error with the sample code from this link:我已经使用 Epson TM-T88V 打印机实现了 JavaPOS 并且我遇到了同样的错误,但我能够使用此链接中的示例代码解决该错误:

http://jpos.1045706.n5.nabble.com/file/n2250344/StarReceiptTest.java http://jpos.1045706.n5.nabble.com/file/n2250344/StarReceiptTest.java

Look at the part that starts and terminates a printing transaction.查看启动和终止打印事务的部分。

Hope it helps.希望能帮助到你。

I had the same Problem.我有同样的问题。

To fix this I have deinstall the Epson JavaPOS-ADK and reinstall it.为了解决这个问题,我卸载了 Epson JavaPOS-ADK 并重新安装了它。 While reinstalling the ADK again I have checked that I have select the right jpos.xml (that jpos.xml what I also used in my application).再次重新安装 ADK 时,我检查了我是否选择了正确的 jpos.xml(即我在应用程序中也使用的 jpos.xml)。 After that the error was gone ...在那之后,错误消失了......

Hope this helps some other guys with the same problem ...希望这可以帮助其他一些有同样问题的人......

Same problem here, the other answers didn't help for my issue.同样的问题,其他答案对我的问题没有帮助。

I was able to install Epson_JavaPOS_ADK_11120.exe on a Win 10 64 with the steps below, it took me 3 days to figure this out:我能够通过以下步骤在Win 10 64上安装Epson_JavaPOS_ADK_11120.exe ,我花了 3 天时间才弄明白:

  • remove any version of Java from Control Panel, reboot从控制面板中删除任何版本的 Java,重新启动
  • install jdk-6u45-windows-i586.exe , reboot安装jdk-6u45-windows-i586.exe ,重启
  • replace java.exe , javaw.exe , javaws.exe in C:\\ProgramData\\Oracle\\Java\\javapath with the executable provided by the new Java installation from C:\\Program Files\\Java\\jre6\\binC:\\ProgramData\\Oracle\\Java\\javapath java.exejavaw.exejavaws.exe替换为C:\\Program Files\\Java\\jre6\\bin新安装的 Java 提供的可执行C:\\Program Files\\Java\\jre6\\bin
  • execute the Epson installer as Administrator管理员身份执行爱普生安装程序
  • restore your system when done完成后恢复系统

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM