如何使用PAX A920打印收据?

huangapple go评论113阅读模式
英文:

How to print receipt with PAX a 920?

问题

我有一台运行Android系统的Pax A920设备。
那么在Java中如何使用打印服务呢?

英文:

I have Pax A920 which runs with android .
So how to using printing service in java?

答案1

得分: 1

我建议您使用Neptune API。您可以在Google上搜索"Pax 920 Neptune API演示",第一个显示的链接(https://docs.hips.com/docs/pax-a920)包含一个展示所有基本功能(包括打印机)的演示,您可以在您的设备上运行它:

在应用程序中,您首先需要一个用于检索IDAL的函数:

  1. public static IDAL getDal() {
  2. if(dal == null){ // dal是应用程序的一个私有静态IDAL变量
  3. try {
  4. dal = NeptuneLiteUser.getInstance().getDal(context);
  5. } catch (Exception e) {}
  6. }
  7. return dal;
  8. }

然后在您的活动中,您只需要执行以下操作:

  1. try {
  2. IPrinter printer = MyApp.getDal().getPrinter();
  3. printer.init();
  4. printer.printStr("您的文本", null);
  5. printer.start();
  6. } catch (PrinterDevException e) {
  7. e.printStackTrace();
  8. }
英文:

I suggest you to use the Neptune api. you can google pax 920 neptune api demo and the fist link that shows up (https://docs.hips.com/docs/pax-a920) contains a demo that shows all the basic functions (including the printer) and you can run it on your device:

In the Application you first need a function to retrieve the IDAL:

  1. public static IDAL getDal() {
  2. if(dal == null){ //dal is a private static IDAL variable of the application
  3. try {
  4. dal = NeptuneLiteUser.getInstance().getDal(context);
  5. } catch (Exception e) {}
  6. }
  7. return dal;
  8. }

then in your activity you can just do the following:

  1. try {
  2. IPrinter printer= MyApp.getDal().getPrinter();
  3. printer.init();
  4. printer.printStr("Your text",null);
  5. printer.start();
  6. } catch (PrinterDevException e) {
  7. e.printStackTrace();
  8. }

huangapple
  • 本文由 发表于 2020年9月6日 06:35:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/63759114.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定