bluetooth_print icon indicating copy to clipboard operation
bluetooth_print copied to clipboard

Control size of image

Open hifiaz opened this issue 5 years ago • 5 comments

hello, I have try with size paper 58mm, and try to control size of image, how to do that

hifiaz avatar Jun 17 '20 11:06 hifiaz

->Firstly you must open your project with android studio ->open MainActivity.java or .kt ->Click Open For Editing in Android Studio ->open /bluetooth_print/java/com.../PrintContent.java and change esc.addRastBitImage(bitmap, 576, 0); to esc.addRastBitImage(bitmap, 480, 0); I hope run your code :)

emrahkocinkag avatar Aug 23 '20 13:08 emrahkocinkag

请问你解决了吗 我在打印70mm 宽时 发现打印图片 无法铺满整个标签

junkai-li avatar Sep 25 '20 03:09 junkai-li

edit bluetooth_print/android/src/main/java/com/example/bluetooth_print/PrintContent.java file,

change the below code to

else if("image".equals(type)){
        byte[] bytes = Base64.decode(content, Base64.DEFAULT);
        Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
        esc.addRastBitImage(bitmap, 576, 0);
  }

to

else if("image".equals(type)){
        byte[] bytes = Base64.decode(content, Base64.DEFAULT);
        Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
        esc.addRastBitImage(bitmap, width, 0);
  }

use this code flutter/dart program,

list.add(LineText(
        type: LineText.TYPE_IMAGE,
        content: base64Image,
        align: LineText.ALIGN_CENTER,
        width: 150,
        height: 150,// pass desired width
        size: 1,
        weight: 1,
        linefeed: 1));

M6268 avatar Jan 01 '21 13:01 M6268

Any update to solve this?

c0c4i avatar Feb 05 '21 12:02 c0c4i

How can I solve also on ios?

c0c4i avatar Feb 08 '21 09:02 c0c4i