我有运行 android 的 Pax A920。那么如何在java中使用打印服务呢?
问问题
757 次
1 回答
0
我建议你使用 Neptune api。你可以google pax 920 neptune api demo,显示的第一个链接(https://docs.hips.com/docs/pax-a920)包含一个演示,显示所有基本功能(包括打印机),你可以运行它在您的设备上:
在应用程序中,您首先需要一个函数来检索 IDAL:
public static IDAL getDal() {
if(dal == null){ //dal is a private static IDAL variable of the application
try {
dal = NeptuneLiteUser.getInstance().getDal(context);
} catch (Exception e) {}
}
return dal;
}
然后在您的活动中,您可以执行以下操作:
try {
IPrinter printer= MyApp.getDal().getPrinter();
printer.init();
printer.printStr("Your text",null);
printer.start();
} catch (PrinterDevException e) {
e.printStackTrace();
}
于 2021-06-07T06:05:29.940 回答