コード例 #1
0
 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?
 }
コード例 #2
0
ファイル: PrintService.cs プロジェクト: smalgin/Forms9Patch
        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();
        }