【问题标题】:printing an image on a Bluetooth printer in Android在 Android 的蓝牙打印机上打印图像
【发布时间】:2017-03-20 10:54:32
【问题描述】:

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

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

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

但不知何故,它显示为 image 。我尝试了 cmets 中给出的一些选项,但它不起作用。

谁能帮帮我?提前谢谢

【问题讨论】:

  • 您好,请问这个问题怎么解决?

标签: android arrays printing bluetooth


【解决方案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)

【讨论】:

  • 有没有办法在 Printooth 中打印宽度超过 256 像素的图像?
【解决方案2】:

好的,处理这个。

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

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

参考 - post

输出图像是

【讨论】:

  • 你好。我有一个问题如何将 130x130 像素设置为图像大小?
  • @Faxriddin Abdullayev bitmap.scale(130, 130) 在 Kotlin 中。
猜你喜欢
  • 2013-01-09
  • 2011-12-28
  • 2011-07-05
  • 2018-11-14
  • 2015-10-28
  • 1970-01-01
  • 2016-06-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多