Results 1 to 4 of 4
  1. #1
    raffur is offline Member
    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    Question Porblem sending image to printer

    Hello, I'm facing the same problem and maybe someone here could help me. I've send the image to the printer (M-Class mark II 4206) but the size on the printer is different than the size of byte_array that I'm sending. The sended image doesn't print from the java application but when I print it directly from printer's menu it prints some strange patterns. Here is how I make the conversion:
    Java Code:
              String nazwa_loga="a.bmp";
              File f_logo=new File(nazwa_loga);
              BufferedImage im_buf=ImageIO.read(f_logo);
    
              java.io.ByteArrayOutputStream baos=new ByteArrayOutputStream();
              ImageIO.write(im_buf,"bmp", baos);
              byte[] b_logo=baos.toByteArray();
    
              java.nio.charset.Charset charset = java.nio.charset.Charset.forName("ISO-8859-1"); 
              String logo_s=new String(b_logo,charset);
    When i change encoding the size on the printer changes. For any suggestions thanks in advance

  2. #2
    lipkerson is offline Member
    Join Date
    May 2010
    Location
    Poland-Silesia
    Posts
    17
    Rep Power
    0

    Default Re: JAVA and DPL-problems with sending image to printer

    You dont' have my problem. My was more generic.
    The answer to Your problem is quite simple: don't try to convert byte[] to String.
    You need to send pure byres data to printer. All the string commands at the end nedd to be converted to byte[] yes? So join arrays that contains command with byte array that contain a bmp file. It works ust fine.

    Tak przy okazji to jesteś z polski?

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Porblem sending image to printer

    Removed from JAVA and DPL-problems with sending image to printer

    raffur, when you have a question start your own thread. Don't post to long dead threads and don't hijack another poster's thread.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    raffur is offline Member
    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    Default Re: Porblem sending image to printer

    Thanks a lot, now it works. The problem was really obvious i don't know why I made that conversion.

    Tak jestem z Polski, sądząc po lokalizacji nawet z bliskiego rejonu ;)

Similar Threads

  1. JAVA and DPL-problems with sending image to printer
    By lipkerson in forum Advanced Java
    Replies: 10
    Last Post: 07-11-2010, 10:08 AM
  2. sending data to printer directly
    By Abhinav.k in forum Advanced Java
    Replies: 4
    Last Post: 12-09-2009, 07:26 AM
  3. Sending text to printer
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 05-25-2009, 06:14 AM
  4. Sending PCL to Citizen Printer
    By CommanderLuv in forum Java Tip
    Replies: 0
    Last Post: 04-02-2009, 02:20 PM
  5. Replies: 2
    Last Post: 02-20-2009, 07:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •