Print jpeg/png images using Wifi/Bluetooth Printer from Android app

1.8k Views Asked by At

I have Hp Photosmart Wifi printer and I developed app for one of my product. Now I would like to add the functionality of printing images from my app using Wifi printer. I want to connect my app with wifi printer and for that i did some googling and found that I can do so using Socket programming as wifi has the IP address. But i am unable to find anything which can help me for printing images from android app programmatically.

Can anyone guide me how can i print images on A4 size paper with Wifi printer from my app? All suggestions are welcome.

1

There are 1 best solutions below

1
On

I used this for blutooth

try this for wifi also

OutputStream os = null;
    try {
        os = wifiSocket.getOutputStream();
        } catch (Exception e) {
        e.printStackTrace();
}
os.write(("Hello").getBytes());
os.write(("printing").getBytes());
os.close();

for printing the image you need to send some commands before print the data,

need to convert the image to byte array and then you need to send to printer.