diff --git a/components/tpx-bluetooth-print/nativePrint/tanexPrinterUniSdk.js b/components/tpx-bluetooth-print/nativePrint/tanexPrinterUniSdk.js index 344989d..f83afed 100644 --- a/components/tpx-bluetooth-print/nativePrint/tanexPrinterUniSdk.js +++ b/components/tpx-bluetooth-print/nativePrint/tanexPrinterUniSdk.js @@ -51,8 +51,9 @@ var tanexPrinter = { /* [名称] 开始命令 [格式] ! {offset} 200 200 {height} {qty} [说明] {offset}:整个标签的水平偏移量 200:水平分辨率,203 点/英寸(8 点/mm) 200:垂直分辨率,203 点/英寸(8 点/mm) {height}:标签最大高度,点为单位 {qty}:打印标签的数量,最大1024 张 [实例] Input: Output: ! 0 200 200 210 1 TEXT 4 0 30 40 Hello World Hello World FORM PRINT */ - tanexPrinter.init = function(maxHeight = 1040) { - // 1040 一页打印纸的高度 + tanexPrinter.init = function(maxHeight = 700) { + console.log("page maxHeight====", maxHeight) + // 700 一页打印纸的高度, TODO data = " ! 0 200 200 " + maxHeight + " 1\r\n" tanexPrinter.addCommand(data) }; @@ -124,7 +125,9 @@ var tanexPrinter = { [名称] 设置打印命令 [格式] {command} [说明] {command}:PRINT 在CPCL 指令模式下,打印命令终止和打印文件,这是最后的一条命令;执行打印命 令后,打印机退出控制段,在打印命令后,必须跟一个回车。 如果打印中出错,等待错误恢复后重新打印。 [实例] Input: ! 0 200 200 210 1 …………… PRINT */ tanexPrinter.setPagePrint = function() { - data = "PRINT \r\n" + data = "GAP-SENSE\r\n" + data += "FORM \r\n" // 走一整页 + data += "PRINT \r\n" // 开始打印 tanexPrinter.addCommand(data) }; diff --git a/components/tpx-bluetooth-print/render-template-native.vue b/components/tpx-bluetooth-print/render-template-native.vue index 90e7c12..b15cc54 100644 --- a/components/tpx-bluetooth-print/render-template-native.vue +++ b/components/tpx-bluetooth-print/render-template-native.vue @@ -58,7 +58,7 @@ export default { return reject('打印参数校验不通过') } let prtInstance = tanexPrinterUniSdk.createInstance() - prtInstance.init(that.imgRes.heigh) + prtInstance.init(that.imgRes.height) // prtInstance.diyCode(`PAGE-WIDTH 600\r\n`) prtInstance.addBitmapByEG(0, 0, that.imgRes.imgData) prtInstance.setPagePrint() diff --git a/components/tpx-bluetooth-print/tpx-bluetooth-print.vue b/components/tpx-bluetooth-print/tpx-bluetooth-print.vue index c255508..85cd3d8 100644 --- a/components/tpx-bluetooth-print/tpx-bluetooth-print.vue +++ b/components/tpx-bluetooth-print/tpx-bluetooth-print.vue @@ -105,7 +105,8 @@ export default { }, async confirmPrint(){ this.imageUrl.map(async (url, index)=> { - url = `${url}?t=${new Date().valueOf()}` // canvas渲染的图必须修改url,否则渲染不出来 + // !!!注意:必须修改。 canvas渲染的图必须修改url,否则渲染不出来 + url = `${url}?t=${new Date().valueOf()}` let imgRes = await this.$refs[`curCanvas${index}`][0].renderCanvasImg(url, this.paperWidth) let res = await this.$refs.curPrint.callPrint({ imgRes,