首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >JavaPOS打印文本抛出JposException

JavaPOS打印文本抛出JposException
EN

Stack Overflow用户
提问于 2013-02-11 00:17:38
回答 3查看 5.2K关注 0票数 2

我很难设置一个小程序来与爱普生TM-T88V pos打印机一起工作。现在我可以发送切割器的命令,它就可以工作了。但打印任何其他文本是不可能的。

将发生以下jpos.JposException:

代码语言:javascript
运行
复制
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)  
  ...

我的代码如下所示:

代码语言:javascript
运行
复制
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) {
    }
}

异常指向下面这行:

代码语言:javascript
运行
复制
ptr.printNormal(POSPrinterConst.PTR_S_RECEIPT, "1\n");

如果我从eclipse运行代码,一切都很正常。如果我去掉这条线,切割机就能正常工作。但是如果我想打印任何文本,就会抛出给定的异常。

我的问题出在哪里?

EN

回答 3

Stack Overflow用户

发布于 2013-04-29 16:18:11

我已经使用爱普生TM-T88V打印机实现了JavaPOS,并且我也遇到了同样的错误,但我能够通过以下链接中的示例代码解决该错误:

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

看看启动和终止打印事务的部分。

希望能有所帮助。

票数 2
EN

Stack Overflow用户

发布于 2014-06-24 00:29:04

我也有同样的问题。

为了解决这个问题,我卸载了Epson JavaPOS-ADK,然后重新安装它。当再次重装ADK时,我检查了我是否选择了正确的jpos.xml (也就是我在应用程序中使用的jpos.xml )。在那之后,错误就消失了。

希望这对其他有同样问题的人有所帮助。

票数 0
EN

Stack Overflow用户

发布于 2021-01-11 17:33:06

这里也有同样的问题,其他答案对我的问题没有帮助。

我能够通过以下步骤在Win 10 64上安装Epson_JavaPOS_ADK_11120.exe,我花了3天的时间才弄明白:

  • 从控制面板中删除任何版本的Java,重新启动
  • install jdk-6u45-windows-i586.exe,重新启动
  • 将D11中的java.exejavaw.exe,D10替换为新的Java安装程序提供的可执行文件<代码>h217<代码>F218
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14799758

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档