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? }
async Task OnPageFinished(Android.Webkit.WebView webView, string jobName, PageSize pageSize, PageMargin margin, TaskCompletionSource <ToFileResult> taskCompletionSource) { if (string.IsNullOrWhiteSpace(jobName)) { jobName = Forms9Patch.ApplicationInfoService.Name; } var printMgr = (PrintManager)Settings.Context.GetSystemService(Context.PrintService); await Task.Delay(1000); // allow a bit more time for the layout to complete; printMgr.Print(jobName, webView.CreatePrintDocumentAdapter(jobName), null); _activityIndicatorPopup.Dispose(); _activityIndicatorPopup = null; taskCompletionSource.SetResult(new ToFileResult(false, jobName)); webView.Dispose(); }