2017-09-19 31 views
1

我有一臺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)); 
} 

如何打印使用這個插件的形象?任何幫助,將不勝感激。

回答

0

更新答案:

這是Owner of the plugin說:

你可能需要將圖像轉換爲格式打印機可以 理解。也許像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 
+0

感謝您的答覆。我試過了,打印機將base64數據打印爲文本。 –

+0

你不能直接做,請看更新後的帖子。 – Sampath

+0

是否可以通過ESC/POS命令進行打印?我發現'GS(L/GS 8 L'這個命令必須做一些打印圖像 –