在Android中的蓝牙打印机上打印图像

时间:2017-03-20 10:54:33

标签: android arrays printing bluetooth

我正在通过Bluetooth打印机打印下面的图片。

enter image description here

我引用此链接link进行打印。 图像尺寸为100 x 100像素,图像模式为

public static byte[] SELECT_BIT_IMAGE_MODE = {0x1B, 0x2A, 33, (byte)255, 0};

但不知怎的,它显示为image。香港专业教育学院尝试了评论中给出的一些选项,但它不起作用。

任何人都可以帮助我吗?先谢谢

2 个答案:

答案 0 :(得分:1)

您可以对任何打印机使用printooth库,printooth简单且文档齐全, https://github.com/mazenrashed/Printooth

var printables = ArrayList<Printable>()
var printable = Printable.PrintableBuilder()  
    .setImage(image) 
    .setNewLinesAfter(1) // To provide n lines after sentence
    .build()
printables.add(printable)
BluetoothPrinter.printer().print(printables)

答案 1 :(得分:0)

好的工作。

使用130x130像素图像 单mService.write(PrinterCommands.FEED_LINE);

和图像模式是 public static byte[] SELECT_BIT_IMAGE_MODE = {0x1B, 0x2A, 33, (byte)255, 0};

参考 - post

输出图像

enter image description here