public override async Task <bool> PrintImageFromByteArrayAsync(byte[] content, PrintJobConfiguration printJobConfiguration) { // based on https://github.com/bushbert/XamarinPCLPrinting/blob/master/PCLPrintExample/PCLPrintExample/PCLPrintExample.Android/Print.cs bool result = false; try { if (PrintImageFromByteArrayAsyncSupported) { //using ( Stream inputStream = new MemoryStream(content); //) { PrintServiceAndroidHelper.PrintImageFromStream(inputStream, printJobConfiguration); result = true; } } } #pragma warning disable CA1031 // Do not catch general exception types catch (System.Exception ex) { await PrintStatusReporting.ReportExceptionAsync(ex); } #pragma warning restore CA1031 // Do not catch general exception types return(result); }
public override async Task <bool> PrintImageFromStreamAsync(Stream inputStream, PrintJobConfiguration printJobConfiguration) { bool result = false; try { if (PrintImageFromStreamAsyncSupported) { PrintServiceAndroidHelper.PrintImageFromStream(inputStream, printJobConfiguration); result = true; } } #pragma warning disable CA1031 // Do not catch general exception types catch (System.Exception ex) { await PrintStatusReporting.ReportExceptionAsync(ex); } #pragma warning restore CA1031 // Do not catch general exception types return(result); }