public override async Task <bool> PrintWebViewAsync( Page parentPage, WebView webView, IWebViewAdditionalFunctions webViewAdditionFunctions, PrintJobConfiguration printJobConfiguration) { bool result = false; try { if (PrintWebViewAsyncSupported && (webViewAdditionFunctions?.NativeControl is Android.Webkit.WebView nativeWebView)) { PrintServiceAndroidHelper.PrintFromWebView(nativeWebView, printJobConfiguration); result = true; } } catch (Java.Lang.Exception jlex) { await PrintStatusReporting.ReportExceptionSilentlyAsync(jlex); } #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 void OnPageFinished(Android.Webkit.WebView webView, string url) { // TODO - investigate whether even using OnPageFinished is enough to always avoid getting a blank page output PrintServiceAndroidHelper.PrintFromWebView(webView, _printJobConfiguration); _printJobConfiguration = null; _webView.Dispose(); _webView = null; Dispose(); // is this legitimate? }
public void Run() { _webView = new Android.Webkit.WebView(PrintServiceAndroidHelper.ActivityInstance); _webView.LoadUrl(_url); PrintServiceAndroidHelper.PrintFromWebView(_webView, _printJobConfiguration); }