How to print image with text from android phone to Bluetooth printer.? -


I want to print some text with an image that stays on the Bluetooth printer on my Android phone, but the text is successfully Has been printed and the image has not been printed on paper.

I am using the following code:

  The public class extends the SendingDataActivity activity {/ ** when the activity is created first. * / Personal Bluetooth Adapter mBluetoothAdapter = Faucet; Fixed final UUID MY_UUID = UUID.from string ("fa87c0d0-afac-11de-8a39-0800200c9a66"); Static String Address = "50: C3: 00: 00: 00: 00"; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.main); MBluetoothAdapter = BluetoothAdapter.getDefaultAdapter (); If (mBluetoothAdapter == faucet) {Toast. Maketext (this is, "Bluetooth is not available.", Toast. LNNHH_LOG). Show (); End(); Return; } If (! MBluetoothAdapter.isEnabled ()) {Toast.makeText ("Please enable your BT and run this program again.", Toast.LnnGH_LOG). Show (); End(); Return; } Last SendData sendData = New SendData (); Send Button Button = (Find Button) VVBIID (Raid Endand); SendButton.setOnClickListener (New OnClickListener) {Click Public Zero (see View) {sendData.sendMessage ();}}); } Extended SendData Thread {Private BluetoothDevice Device = Zero; Private BluetoothSocket btSocket = null; Private Output Stream Outstream = Faucet; Public SendData () {device = mBluetoothAdapter.getRemoteDevice (address); Try {btSocket = device.createRfcommSocketToServiceRecord (MY_UUID); } Hold (exception e) {// TODO: handling exceptions} mblluetoothAdapter.cancelDiscovery (); Try {btSocket.connect (); } Hold (IOException e) {try {btSocket.close (); } Grip (IOException E2) {}} Toast. GetBaseContext, "Connected" + device.getName (), toast .LENGTH_SHORT). Show (); {Try outstream = btSocket.getOutputStream (); } Grip (IOException E) {}} Public Zero Send Message () {try {mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter (); Bitmap BM = BitMapFrenchDocument (ResourceWeb); BytereonOperputTemperatureBaos = New BytereOutStream (); Bm.compress (bitmap compoforat.jpeg, 100, baoos); // BM bitmap object is byte [] b = baos.toByteArray (); Toast. Make text (getBaseContext), string.valouf (B.LimPump), toast.lnn.gif.hORT). Show (); OutStream.write (b); OutStream.flush (); } Catch (IOException E) {}}}}  

This code works and prints text on text only.

Thank you.

<

Do this with a cloud printer.

Check this link:


Comments