【发布时间】:2016-09-23 18:50:23
【问题描述】:
我有一个 sm-t300i,我想弄清楚如何从数据库中打印图像。我有图像数据,但不知道如何插入。我已经成功地从资产中添加了图像,但不确定如何从原始图像数据中添加图像。下面的代码来自资产。同样由于某种原因,下面代码中的图像不会居中,我还需要做些什么来使图像居中。谢谢。
AssetManager assetManager = mContext.getAssets();
InputStream istr = null;
try {
istr = assetManager.open("www/img/logo.bmp");
} catch (IOException e) {
e.printStackTrace();
}
Bitmap bm = BitmapFactory.decodeStream(istr);
StarBitmap starbitmap = new StarBitmap(bm, false, 200);
commands.add(new byte[] { 0x1b, 0x61, 0x01 }); //align center
commands.add(starbitmap.getImageEscPosDataForPrinting(false,false));
【问题讨论】: