uu
This commit is contained in:
parent
f2face931c
commit
6452e107ce
@ -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)
|
||||
};
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user