如何解决如何将图像打印到 Android 中的蓝牙热敏打印机?
我正在打印文本和图像。文本打印正常,但图像打印不正确。我正在使用此代码打印所有内容。
private void printTokentest() {
String line = "---------------------------";
String agentName = AppSettings.getString(AppSettings.name);
String token = "Token Number: " + tokenNumber;
String checkInTime = "Check In Time: " + checkInDateTime;
String poweredBy = "Powered by";
String appName = "Dummy\n\n\n";
printCustom(AppSettings.getString(AppSettings.name),2,0);
printNewLine();
printCustom(line,1,0);
printNewLine();
printCustom(agentName,0);
printNewLine();
printPhoto();
printNewLine();
printCustom(token,0);
printNewLine();
printCustom(checkInTime,0);
printNewLine();
printCustom(poweredBy,0);
printNewLine();
printCustom(appName,1);
printNewLine();
mService.sendMessage("","GBK");
}
public void printPhoto() {
try {
byte[] command = AppUtils.decodeBitmap(AppUtils.getScreenShotBitmap(ivQRCode));
mService.write(PrinterCommands.ESC_ALIGN_CENTER);
printText(command);
} catch (Exception e) {
e.printstacktrace();
Log.e("PrintTools","the file isn't exists");
}
}
//print byte[]
private void printText(byte[] msg) {
// Print normal text
mService.write(msg);
}
但它打印的图像是这样的。 “ivQRCode”是我从那里获取位图的图像视图。
有人可以帮忙吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。