LinkOS-Android-Samples
LinkOS-Android-Samples copied to clipboard
Image Printing issue on imz320
I am trying to print Image from Zebra Print Demo App over Bluetooth, but not printing the same size of an image. Some parts of the Image are cut. Please check the attached image.
private void printPhotoFromExternal(final Bitmap bitmap) {
new Thread(new Runnable() {
public void run() {
try {
getAndSaveSettings();
Looper.prepare();
helper.showLoadingDialog("Sending image to printer");
Connection connection = getZebraPrinterConn();
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
if (((CheckBox) findViewById(R.id.checkBox)).isChecked()) {
printer.storeImage(printStoragePath.getText().toString(),
new ZebraImageAndroid(bitmap),
bitmap.getWidth(),
bitmap.getHeight());
} else {
printer.printImage(new ZebraImageAndroid(bitmap),
0, 0, bitmap.getWidth(),
bitmap.getHeight(),false);
}
connection.close();
if (file != null) {
file.delete();
file = null;
}
} catch (ConnectionException e) {
helper.showErrorDialogOnGuiThread(e.getMessage());
} catch (ZebraPrinterLanguageUnknownException e) {
helper.showErrorDialogOnGuiThread(e.getMessage());
} catch (ZebraIllegalArgumentException e) {
helper.showErrorDialogOnGuiThread(e.getMessage());
} finally {
bitmap.recycle();
helper.dismissLoadingDialog();
Looper.myLooper().quit();
}
}
}).start();
}

The image is wider than the width of ZQ320, which is a 3" printer. So a portion of the image top was cut. You need to scale the image to fit the width of the printer. In terms of the cut of the right side of the image, make sure that the setting of the label length on the printer is long enough to cover the entire length of the image. Use the following two commands to check and set the length.
! U1 getvar "zpl.label_length"<CR><LF> ! U1 setvar "zpl.label_length" "200"<CR><LF>
https://github.com/nssoftengineer/BluetoothPrinter