how to print a image via bluetooth using java me?

Posted on 2010-01-04
Last Modified: 2013-12-14
hello experts,

Anybody know how to print a image via bluetooth?

I try with this code, but isn´t works, if anybody knows what is wrong in this code or other form to do this, please tell me. I took the printer bluetooth adress directly from the printer.

I use java me MIDP 2.0, cellphone Nokia 5130 and a printer Epson pm 260.

The printer only acept images in JPG and TIFF format
//I try this, but isn´t work

try {

//reed the image from a file, and saved in a byte array (img)

FileConnection fc=(FileConnection)"file:///E:/Extra/imagen.jpg",Connector.READ_WRITE);

InputStream is=fc.openInputStream();

byte img[]=new byte[(int)fc.fileSize()];;



//do a bluetooth connection

StreamConnection btcon;

btcon =(StreamConnection)"btspp://00158336E722;master=false;encrypt=false;authenticate=false");

OutputStream output = btcon.openOutputStream();

//send the image to the printer




}catch(Exception e){System.err.println("error: " + e);}

Open in new window

Question by:Dermofit
    LVL 4

    Accepted Solution

    Dear Dermofit,

    I would like to know are you discovering the device and are you able to print the text to printer. I suppose looking at the piece of routine you must be discovering the device if not please do it. Further, if you are able to print the text and image is not being printed, I suppose it problem with the Image file.

    Let me know as I am also working on the similar project.


    Prasmin Mehta

    Author Comment

    Thanks for you input Prasmin. It seems that for the moment our project will not be using bluetooh. Thanks, for your time though.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now