I am trying to print a logo on a thermal bluetooth printer with the following command
`foreach (BluetoothDevice d in bthD)
{
if (d.Name.ToString().Trim() == "MPT-III")
{
Java.Util.UUID UUID = Java.Util.UUID.FromString("00001101-0000-1000-8000-00805F9B34FB");
BluetoothSocket s = null;
s = d.CreateRfcommSocketToServiceRecord(UUID);
var icon = Android.Graphics.BitmapFactory.DecodeResource(Resources, Resource.Drawable.img_p); var ms = new MemoryStream(); icon.Compress(Android.Graphics.Bitmap.CompressFormat.Png, 0, ms); var iconBytes = ms.ToArray(); IntPtr createRfcommSocket = JNIEnv.GetMethodID(d.Class.Handle, "createRfcommSocket", "(I)Landroid/bluetooth/BluetoothSocket;"); IntPtr _socket = JNIEnv.CallObjectMethod(d.Handle, createRfcommSocket, new Android.Runtime.JValue(1)); s = Java.Lang.Object.GetObject<BluetoothSocket>(_socket, JniHandleOwnership.TransferLocalRef); bth1.CancelDiscovery(); s.Connect(); s.OutputStream.Write(iconBytes, 0, iconBytes.Length); s.OutputStream.Close(); s.Close(); } }`
Printing so generates
Posts
not too bad
To print an image I think you should send also some "ascii command" depending the printer language... which is the printer language of your printer?
I use the following language ESC-POS
http://www.starmicronics.com/support/mannualfolder/escpos_cm_en.pdf
I could not solve the problem with this document, I did not understand very well how I will apply this language at my command
Does anyone have any examples for me to implement at my command ?
Hello @KDW
You solved this prblem?.
I am facining same problem.