uniapp操作hiti打印机

641次阅读
没有评论

uniapp操作hiti打印机, hiti-printer

体验版App

地址1

https://github.com/luomor/hiti-printer/releases/download/v0.0.1/luomor-hiti-printer.apk.zip

地址2

https://gitee.com/luomor/file/releases/download/v0.0.1/luomor-hiti-printer.apk.zip

页面浏览

uniapp操作hiti打印机

You can init service at the first page, start the service at the next page.

uniapp操作hiti打印机

一、如何使用

1. 引入module

var printerModule = uni.requireNativePlugin("Luomor-Hiti-Printer")

2. init service

let ret = printerModule.initService();

init service should run first.

3. start service

let ret = printerModule.startService();

start service should run when the service is destroy
the service may be destroyed by system, like lock the screen.
Sugguestion: You check the service status on page show, start it if the service is destroy.

4. serviceStatus

let ret = printerModule.serviceStatus();

get the service status, “running”, “destroy”

5. get the printer status

let param = {
  "action": ACTION.USB_CHECK_PRINTER_STATUS
};
printerModule.operatePrinter(param,
  (ret) => {
    console.log(ret);
    modal.toast({
    message: ret["msg"],
    duration: 1.5
  });
})

This function is async, the printer status return the result by callback.

二、完整参考代码

https://github.com/luomor/hiti-printer/blob/main/uniapp-hiti-printer/pages/sample/ext-printer.nvue

三、Read more

https://www.hiti.com/support/download.aspx?MenuID=72&lang=CN

https://sq4d05hfpx9.feishu.cn/wiki/T6jKw7dG2iPuTJklGQHcoPxLndh?from=from_copylink

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 
评论(没有评论)