How to Print Images with a POS Printer
- Put image to the assets folder of the application project.
- Call print image api to print, snippet code is as follows:
public void printBitmap(Map<String, Object> param, ActionCallback callback) {
Bitmap bitmap =null;
try {
bitmap = BitmapFactory.decodeStream(mContext.getResources().getAssets()
.open("photo.bmp"));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
device.printBitmap(bitmap);
sendSuccessLog(mContext.getString(R.string.operation_succeed));
} catch (DeviceException e) {
e.printStackTrace();
sendFailedLog(mContext.getString(R.string.operation_failed));
}
}