ZQ520 Cancel Print

I am developing an Android app which prints to a ZQ520 printer using CPCL and ZSDK.  A problem has been reported where extra copies of labels are printing, and I think it happens when the user has tried to print but the printer is switched off and then resubmits the print request once the printer is powered up.  Is there a way to cancel the failed request so that it does not print when the app eventually connects to the printer?  Here is my print method:

 

private boolean zebraPrint(String content) {

   boolean retval = false;

   try {

   //PrinterStatus printerStatus = printer.getCurrentStatus();

   ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(printer);

  PrinterStatus printerStatus = (linkOsPrinter != null) ? linkOsPrinter.getCurrentStatus() : printer.getCurrentStatus();

 

   if (printerStatus.isReadyToPrint) {

   printStatus = BluetoothPrinterHelper.READY_TO_PRINT;

  System.out.println("Ready To Print");

  } else if (printerStatus.isPaused) {

   printStatus = BluetoothPrinterHelper.PAUSED;

  System.out.println("Cannot Print because the printer is paused.");

   return false;

  } else if (printerStatus.isHeadOpen) {

   printStatus = BluetoothPrinterHelper.HEAD_OPEN;

  System.out.println("Cannot Print because the printer head is open.");

   return false;

  } else if (printerStatus.isPaperOut) {

   printStatus = BluetoothPrinterHelper.OUT_OF_PAPER;

  System.out.println("Cannot Print because the paper is out.");

   return false;

  } else {

   printStatus = BluetoothPrinterHelper.UNKNOWN;

  System.out.println("Cannot Print.");

   return false;

  }

 

   byte[] configLabel = content.getBytes("ISO-8859-1");

   printerConnection.write(configLabel);

  retval = true;

  } catch (UnsupportedEncodingException e) {

   printStatus = BluetoothPrinterHelper.UNKNOWN;

  disconnect();

  e.printStackTrace();

  } catch (ConnectionException e) {

   printStatus = BluetoothPrinterHelper.DISCONNECTED;

  disconnect();

 

   if (initialise())

   return zebraPrint(content);

  }

 

 

   return retval;

}