public void PrintBitmap(Bitmap image) { int maxWidth = GetDrawableMaxWidth(); Bitmap scalingImage = ScalingBitmap(image, maxWidth); if (scalingImage == null) { return; } byte[] command = PrinterUtils.DecodeBitmap(scalingImage, heightParting); scalingImage.Recycle(); try { if (command != null) { Write(command); } } catch (IOException e) { throw new IOException(e.Message); } }
public void PrintDrawable(Android.Content.Res.Resources res, int id) { try { int maxWidth = GetDrawableMaxWidth(); Bitmap image = ScalingBitmap(res, id, maxWidth); if (image == null) { return; } byte[] command = PrinterUtils.DecodeBitmap(image, heightParting); image.Recycle(); try { if (command != null) { Write(command); } } catch (IOException e) { throw new IOException(e.Message); } } catch (System.Exception ex) { throw new IOException(ex.Message); } }