小程序CPCL打印图片
发布于 5 年前 作者 panyang 2222 次浏览 来自 问答
writeLogo: function(options) {
   let imgHex = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFF000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000FFFFFFFFFFFFFFFFFF000000000000000000000000000000FFFFFFFFFFFFFFFFFF00000000000000000000000000000000000FFFFFFFFFFFFFF00000000000000000000000000000000000FFFFFFFFFFFFFFF00000000000000000000000000000F00000000FFFFFFFFFF0000000000000000000000000000000000000000FFFFFFFFFF00000000F000000000000000000000FFF00000000FFFFFF000000000000000000000000000000000000000000000FFFFFFF00000000FF000000000000000000000FFF000000000FFF0000000000000000000000000000000000000000000000000FFFF00000000FFFF0000000000000000000FFFFF000000000000000000000000000000000000000000000000000000000000000000000000FFFFF00000000000000000FFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000FFFFFF00000000000000000FFFFFFFF00000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF000000000000000FFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFF000000000000000FFFFFFFFFF00000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFF0000000000000FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFF0000000000000FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFF00000000000FFFFFFFFFFFF00000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFF00000000000FFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFF0000000000FFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFF000000000FFFFFFFFFFFF00000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFF000000000FFFFFFFFFFF00000000000000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFFFFFF000000000FFFFFFFFFFFF00000000FFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFF00000000000FFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFF0000000FFFFFFFFFFFF0000000000FFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFF0000000FFFFFFFFFFF0000000000FFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFF000000FFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFF00000FFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFF00000FFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFFFFF0000FFFFFFFFFFF00000000FFFFFFFFFF000000000FFFFFF000000FFFFFFFFFFFF0000000FFFFFFFF00000000FFFFFFFFFFF0000FFFFFFFFFFF00000000FFFFFFFFF0000000000000FFF000000FFFFFFFFF00000000000000FFFF00000000FFFFFFFFFFF0000FFFFFFFFFF000000000FFFFFFFF000000000000000FF000000FFFFFFFFF0000000000000000FF00000000FFFFFFFFFFF000FFFFFFFFFFF000000000FFFFFFFF00000000000000000000000FFFFFFFFF00000000000000000000000000FFFFFFFFFFF000FFFFFFFFFFF000000000FFFFFFFF00000000000000000000000FFFFFFFFF000000000000000000000000000FFFFFFFFFF000FFFFFFFFFFF000000000FFFFFFFF00000000000000000000000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFFF000000000FFFFFFFF00000000000000000000000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFFF000000000FFFFFFFFF0000000000000000000000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFF0000000000FFFFFFFFFFF00000000000000000000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFF00000000000FFFFFFFFFFFF000000000000000000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFF00000000000FFFFFFFFFFFFFF0000000000000000FFFFFFFFF00000000FFF0000000000000000FFFFFFFFFFF00FFFFFFFFFF000000000000FFFFFFFFFFFFFF000000000000000FFFFFFFFF000000FFFFFF0000000000000000FFFFFFFFFF00FFFFFFFFFF0000000000000FFFFFFFFFFFFFFF0000000000000FFFFFFFFF00000FFFFFFFF000000000000000FFFFFFFFFF0FFFFFFFFFFF00000000000000FFFFFFFFFFFFFFFF00000000000FFFFFFFFF00000FFFF00FFF00000000000000FFFFFFFFFF0FFFFFFFFFFF000000000000000FFFFFFFFFFFFFFFF0000000000FFFFFFFFF0000FFF0F0FF0F00000000000000FFFFFFFFFF0FFFFFFFFFFF00000000000000000FFFFFFFFFFFFFFF000000000FFFFFFFFF0000FFFFF0FFFF00000000000000FFFFFFFFFF00FFFFFFFFFF0000000000000000000FFFFFFFFFFFFFF00000000FFFFFFFFF0000F0FFFFFFFF00000000000000FFFFFFFFFF00FFFFFFFFFF000000000000000000000FFFFFFFFFFFFF0000000FFFFFFFFF00000FFFFFFFFF0000000000000FFFFFFFFFFF00FFFFFFFFFF00000000000000000000000FFFFFFFFFFF0000000FFFFFFFFF000000FFFFFFF00000000000000FFFFFFFFFFF00FFFFFFFFFF0000000000000000000000000FFFFFFFFFF000000FFFFFFFFF0000000FFFFF000000000000000FFFFFFFFFFF00FFFFFFFFFFF0000000000000000000000000FFFFFFFFF000000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFFF00000000000000000000000000FFFFFFFFF00000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFFF000000000000000000000000000FFFFFFFF00000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFFF000000000000000000000000000FFFFFFFF00000FFFFFFFFF000000000000000000000000000FFFFFFFFFFF00FFFFFFFFFFF000000000000000000000000000FFFFFFFF00000FFFFFFFFF000000000000000000000000000FFFFFFFFFF0000FFFFFFFFFF000000000F00000000000000000FFFFFFFF00000FFFFFFFFF00000000000000000000000000FFFFFFFFFFF0000FFFFFFFFFFF00000000FF0000000000000000FFFFFFFF00000FFFFFFFFF00000000000000000000000000FFFFFFFFFFF0000FFFFFFFFFFF00000000FFF000000000000000FFFFFFFF00000FFFFFFFFF00000000000000000000000000FFFFFFFFFFF0000FFFFFFFFFFF00000000FFFFF000000000000FFFFFFFFF00000FFFFFFFFF00000000000000000000000000FFFFFFFFFFF0000FFFFFFFFFFF00000000FFFFFFF000000000FFFFFFFFFF00000FFFFFFFFF0000000000000000000000000FFFFFFFFFFF000000FFFFFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFF0000000000000000000000000FFFFFFFFFFF000000FFFFFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFF0000000000000000000000000FFFFFFFFFFF000000FFFFFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFFFFF0000000FFFFFFFFF000000000000000000000000FFFFFFFFFFFF0000000FFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFF000000000000000000000000FFFFFFFFFFF00000000FFFFFFFFFFF0000000FFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFF00000000000000000000000FFFFFFFFFFFF00000000FFFFFFFFFFFF0000000FFFFFFFFFFFFFFFFFFF0000000000FFFFFFFFF00000000000000000000000FFFFFFFFFFFF000000000FFFFFFFFFFF0000000000FFFFFFFFFFFFFFF00000000000FFFFFFFFF00000000000000000000000FFFFFFFFFFF0000000000FFFFFFFFFFFF000000000000FFFFFFFFF00000000000000FFFFFFFFF0000000000000000000000FFFFFFFFFFFF0000000000FFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFF000000000000FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFF0000000000000FFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFF00000000000000FFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFF000000000000000FFFFFFFF00000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF0000000000000000FFFFFFF000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF00000000000000000FFFFFF0000000000000000000000000000000000000000000000000000000000000000000000FFFFFF000000000000000000FFFFF000000000FF00000000000000000000000000000000000000000000000000FF000000000FFFF00000000000000000000FFF00000000FFFFF00000000000000000000000000000000000000000000000FFFFF000000000FFF000000000000000000000F00000000FFFFFFFF0000000000000000000000000000000000000000000FFFFFFFFF0000000FF0000000000000000000000F0000000FFFFFFFFFFFF00000000000000000000000000000000000000FFFFFFFFFFFF0000000F00000000000000000000000000000FFFFFFFFFFFFFFFF00000000000000000000000000000000FFFFFFFFFFFFFFFF0000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFF00000000000000000000000000FFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFF000000000000000000000000000000000000000000000"
   console.log(imgHex.length)
   let buffs = "! 0 200 200 400 1 \n\r" +
     "EG 25 200 200 0 " + imgHex + "\n\r" +
     "PRINT"
   QRPrinter.sendCmd(buffs, true)

 }

function sendCmd(cmd , print){

glbCmd = glbCmd + cmd + "\n\r"

if(!print)

{

return

}

const base64Str = gbToBase64(glbCmd)

const arrayBuffer = wx.base64ToArrayBuffer(base64Str)

wx.showLoading({

title: '数据传输中',

})

writeBLEValue(arrayBuffer)

}


SendCmd后面的代码就没写了,我想打印顺丰的logo通过小程序蓝牙,但是打印出来的效果非常差,谁知道如何通过小程序打印图片么?如果有更好的方法,请提供帮助,可以有偿!

2 回复

问一下,顺丰LOGO怎么转码拿到imgHex的?

我也遇到同样的问题,打印的图片太小,调整宽高就出问题,不知道楼主解决问题了吗

回到顶部