2 Replies Latest reply on Jan 14, 2019 1:17 AM by Said ZIANI

    Problem when printing an image with zebra ZQ510 Android

    Said ZIANI

      Hello,

      I started printing an image with Zebra ZQ510 via an Android tablet but the printer still print me a string of characters that start with DGE: /storage/emulate.GRF and a sequence of characters.

      Did you find any solution?

       

       

      public static void  printImage(String imagePath,int x,int y, String macAddress)
      {
      String theBtMacAddress = macAddress;
      Connection thePrinterConn = new BluetoothConnectionInsecure(theBtMacAddress);
      
      
      // BITMAP
      BitmapFactory.Options bounds = new BitmapFactory.Options();
      bounds.inSampleSize = 2;
      Bitmap localBitmap = BitmapFactory.decodeFile(imagePath,bounds);
      
      if (localBitmap == null)
      {
      Toast.makeText(getApplicationContext (),"Null Source Bitmap.",Toast.LENGTH_SHORT).show();
      }
      int width = localBitmap.getWidth();
      int height = localBitmap.getHeight();
      
      
      
      // Create new bitmap
      Bitmap newBitmap = Bitmap.createBitmap(localBitmap, 0, 0, width, height);//, matrix, true);
      
      
      if (newBitmap == null){
      Toast.makeText(getApplicationContext (),"Null Source newBitmap.",Toast.LENGTH_SHORT).show();
      }
      
      try {
      
      
      thePrinterConn.open();
      
      ZebraPrinter printer = ZebraPrinterFactory.getInstance(thePrinterConn);
      
      ZebraImageAndroid zebraImage = new ZebraImageAndroid(newBitmap); 
      
      
      printer.storeImage("E:"+imagePath, zebraImage, 550, 412);
      printer.printImage(zebraImage, 0, 0, 550, 412, false);
      
      // Make sure the data got to the printer before closing the connection
      Thread.sleep(500);
      thePrinterConn.close();
      
      }
      catch (Exception e){
      e.printStackTrace();
      }
      }
      

       

       

      thumbnail_IMG_2677.jpg