How to print Arabic Text using bluetooth printer in windows phone 8 silver light app?

1

We need to print Arabic text using Bluetooth Printer in windows phone 8 silver light app. Printing is working fine for English When we are trying to print Arabic text it is not printing as expected? Sample code is given Below:

Public async void PrintTest(string text)
{
var isConnected= await RefreshPairedDevicesList()  

if  (isConnected)
{
 try
            {
                if (_socket != null)
                {
                    DataWriter writer = new DataWriter(_socket.OutputStream);

                    writer.WriteString(text);
                    writer.WriteBytes(Cmd_ESC_JN);  // byte[] Cmd_ESC_JN = new byte[] { 27, 74, 230 };
                    writer.StoreAsync();
                }
            }
            catch { }
}
}
 public async Task<bool> RefreshPairedDevicesList()  
        {
            try
            {
                PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "";

                var peers = await PeerFinder.FindAllPeersAsync();

                if (peers == null && peers.Count == 0)
                {
                    MessageBox.Show("NoPairedDevices");
                    return false;
                }
                else
                {
                    // Found paired devices.
                    foreach (var peer in peers)
                    {
                        _pairedDevices.Add(new PairedDeviceInfo(peer));
                    }

                    PairedDeviceInfo connectedDeive = _pairedDevices.FirstOrDefault();
                    var issuccess = await ConnectToDevice(connectedDeive.PeerInfo);
                    return issuccess;
                }
            }
            catch (Exception ex)
            {
                if ((uint)ex.HResult == 0x8007048F || (int)ex.HResult == -2147467259)
                {
                    var result = MessageBox.Show(MyStoreWP8AppConstants.Msg_BluetoothOff, "Bluetooth Off",          MessageBoxButton.OKCancel);
                    if (result == MessageBoxResult.OK)
                    {
                        ShowBluetoothcControlPanel();
                    }
                    return false;
                }
                else if ((uint)ex.HResult == 0x80070005)
                {
                    MessageBox.Show(MyStoreWP8AppConstants.Msg_MissingCaps);
                    return false;
                }
                else
                {
                    MessageBox.Show(ex.Message);
                    return false;
                }
            }
        }

        private async Task<bool> ConnectToDevice(PeerInformation peer)
        {
            if (_socket != null)
            {
                _socket.Dispose();
                _socket = null;
            }
            try
            {
                _socket = new StreamSocket();
                string serviceName = peer.ServiceName;
                serviceName = String.IsNullOrWhiteSpace(serviceName) ? "1" : serviceName;
                 await _socket.ConnectAsync(peer.HostName, serviceName);
                return true;
            }
            catch (TaskCanceledException taskEx)
            {
                return false;
            }
            catch (Exception ex)
            {
                              MessageBox.Show(ex.Message);

                              if (_socket != null)
                                  _socket.Dispose();
                              _socket = null;
                return false;
            }
}

Could anyone please help us.

Thanks and Regards, WinitWindowsTeam.

windows-phone-8
printing
bluetooth
arabic

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0