更新记录
1.0.2(2025-04-12)
- 优化
1.0.1(2025-04-12)
- 优化demo
1.0.0(2025-04-07)
蓝牙、定位
查看更多
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
- |
- |
- |
- |
4.4 |
× |
× |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
× |
× |
× |
× |
× |
× |
- |
× |
× |
× |
× |
uni-app x
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
5.0 |
× |
× |
× |
Caysn佳能打印机
开发文档
- 集成插件步骤请参考 https://www.cnblogs.com/wenrisheng/p/18323027
接口文档
如需更多接口请联系作者
复制代码
import {
UTSAutoreplyPrint
} from "@/uni_modules/wrs-uts-autoreplyprint"
连接打印机
复制代码
let resp = UTSAutoreplyPrint.EnumUsb()
let usbs = resp.usbs
if (usbs) {
let usb = ""
for (let i = 0; i < usbs.length; i++) {
let str = usbs[i]
if (str.include("0x4B43") || str.include("0x0FE6")) {
usb = str
break
}
}
let name = usb
let autoreplymode = 0
let suc = UTSAutoreplyPrint.CP_Port_OpenUsb(name, autoreplymode)
if (suc) {
this.showMsg("连接成功")
} else {
this.showMsg("连接失败")
}
} else {
this.showMsg("没有发现usb")
}
复制代码
let address = "xxx"
let autoreplymode = 0
let suc = UTSAutoreplyPrint.CP_Port_OpenBtSpp(address, autoreplymode)
复制代码
let address = "xxx"
let autoreplymode = 0
let suc = UTSAutoreplyPrint.CP_Port_OpenBtBle(address, autoreplymode)
复制代码
let localIp = null
let ip = "192.168.0.132"
let port = 9100
let timeout = 5000
let autoreplymode = 0
let suc = UTSAutoreplyPrint.CP_Port_OpenTcp(localIp, ip, port, timeout, autoreplymode)
复制代码
let name = "/dev/ttyS4"
let baund = 115200
let databits = 8
let parity = 0
let stopbits = 0
let flowcontrol = 0
let autoreplymode = 0
let suc = UTSAutoreplyPrint.CP_Port_OpenCom(name, baund, databits, parity, stopbits, flowcontrol, autoreplymode)
复制代码
let suc = UTSAutoreplyPrint.CP_Port_Close()
复制代码
let suc = UTSAutoreplyPrint.CP_Pos_FeedAndHalfCutPaper()
复制代码
let numLines = 5
let suc = UTSAutoreplyPrint.CP_Pos_FeedLine(numLines)
复制代码
let suc = UTSAutoreplyPrint.CP_Pos_ResetPrinter()
复制代码
let suc = UTSAutoreplyPrint.CP_Pos_SetMultiByteMode()
复制代码
let encode = 0
let suc = UTSAutoreplyPrint.CP_Pos_SetMultiByteEncoding(encode)
复制代码
let str = "00000"
let suc = UTSAutoreplyPrint.CP_Pos_PrintText(str)
let suc = UTSAutoreplyPrint.CP_Pos_PrintTextInUTF8(str)
复制代码
let align = 0
let suc = UTSAutoreplyPrint.CP_Pos_SetAlignment(align)
复制代码
let position = 0
let suc = UTSAutoreplyPrint.CP_Pos_SetHorizontalAbsolutePrintPosition(position)
复制代码
let underLine = 0
let suc = UTSAutoreplyPrint.CP_Pos_SetTextUnderline(underLine)
复制代码
let widthScale = 2
let heightScale = 3
let suc = UTSAutoreplyPrint.CP_Pos_SetTextScale(widthScale, heightScale)
复制代码
let height = 60
let suc = UTSAutoreplyPrint.CP_Pos_SetBarcodeHeight(height)
let width = 3
let suc = UTSAutoreplyPrint.CP_Pos_SetBarcodeUnitWidth(width)
let position = 3
let suc = UTSAutoreplyPrint.CP_Pos_SetBarcodeReadableTextPosition(position)
let barcodeType = 65
let str = "xxxx"
let suc = UTSAutoreplyPrint.CP_Pos_PrintBarcode(barcodeType, str)
复制代码
let beepCount = 2
let beepMs = 500
let suc = UTSAutoreplyPrint.CP_Pos_Beep(beepCount, beepMs)
复制代码
let timeout = 3000
let suc = UTSAutoreplyPrint.CP_Pos_QueryPrintResult(timeout)
复制代码
let suc = UTSAutoreplyPrint.CP_Printer_ClearPrinterBuffer()
复制代码
let bold = 3000
let suc = UTSAutoreplyPrint.CP_Pos_SetTextBold(bold)
复制代码
let start = 0
let end = 575
let suc = UTSAutoreplyPrint.CP_Pos_PrintHorizontalLine(start, end)
复制代码
let suc = UTSAutoreplyPrint.CP_Pos_FullCutPaper()
复制代码
let filePath = "/aaaaa/aaa/bb.png"
let binaryzation_method = 0
let compression_method = 0
let suc = UTSAutoreplyPrint.PrintRasterImageFromBitmap(filePath, binaryzation_method, compression_method)