Align print Bluetooth Xamarin

0

I'm printing a remarks that are printed on the bluetooth printer, my code works perfectly what's missing and align the lines correctly, from an ENTER, skips a title space.

At the moment when printing shows this ex: titulotestetestetestete

I want you to stay like this ex:

 titulo

 teste 
 teste
 teste
 teste

My code

BluetoothAdapter bth1 = BluetoothAdapter.DefaultAdapter;
            ICollection<BluetoothDevice> bthD = bth1.BondedDevices;

            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);
                    byte[] buffer = System.Text.Encoding.GetEncoding(0).GetBytes("titulo");
                    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();

                    //try
                    //{

                        s.Connect();
                        s.OutputStream.Write(buffer, 0, buffer.Length);

                        s.Close();
                    //}
                    //catch
                    //{
                    //    //Toast.MakeText(this, "Failed to connect: " + connectException.Message, ToastLength.Short).Show();
                    //    Toast.MakeText(this, "Failed to connect", ToastLength.Short).Show();
                    //}
    
asked by anonymous 25.01.2017 / 12:32

1 answer

0

Hi will you use \ r? or get some linhea jump for that !!! but I am now looking to print with xamarin via blueetooh do you have the source of your code?

Thank you

    
03.07.2017 / 22:56