使用don的蓝牙串行插件打印图像
问题描述:
我有一台Epson TM-P20热敏打印机。我用this link从离子3应用程序打印文本的文本。我的问题是,我不知道如何使用这个插件打印图像。使用don的蓝牙串行插件打印图像
我用WebAPI2作为我的web服务,我装的形象和转换图像为Base64,
public string getLogo()
{
var file = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/logocogbw.png");
return Convert.ToBase64String(File.ReadAllBytes(file));
}
如何打印使用这个插件的形象?任何帮助,将不胜感激。
答
更新答案:
你可能需要将图像转换为格式打印机可以 理解。也许像PCL或PostScript?
这个插件可以发送二进制数据。写入方法接受文本或 二进制数据。看到文档 https://github.com/don/BluetoothSerial#write
另一个useful link
老的回答简单的例子:
你需要做的是这样的:
let data=this.getLogo();//get image data
this.bluetoothSerial.write(data).then(success, failure);// write into port using Bluetooth
感谢您的答复。我试过了,打印机将base64数据打印为文本。 –
你不能直接做,请看更新后的帖子。 – Sampath
是否可以通过ESC/POS命令进行打印?我发现'GS(L/GS 8 L'这个命令必须做一些打印图像 –