window.print is not working in webview. xamarin.android

Viewed 25

I am opening a web page with the help of webview. When I click on a button in it;

var newWindow=window.open();
newWindow.document.body.innerHTML="<table>....</table>";
setTimeout(() => {
    newWindow.print();
    newWindow.close();
}, 1000);

transactions are taking place. but somehow the new screen does not appear and the print screen does not appear either.

and my xamarin.adroid code;

 WebView web_view;
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
        SetContentView(Resource.Layout.activity_main);
        Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);

        web_view = FindViewById<WebView>(Resource.Id.webview);
        web_view.SetWebChromeClient(new ExtendWebChromeClient(this));
        web_view.SetWebViewClient(new WebViewClient());
        web_view.Settings.JavaScriptEnabled = true;
        web_view.Settings.AllowFileAccess = true;
        web_view.Settings.JavaScriptCanOpenWindowsAutomatically = true;
        web_view.Settings.SetSupportMultipleWindows(true);
        web_view.Settings.SetSupportZoom(true);
        web_view.Settings.BuiltInZoomControls = true;
        web_view.Settings.DomStorageEnabled = true;
        web_view.Settings.LoadWithOverviewMode = true;
        web_view.Settings.DisplayZoomControls = true;
        web_view.Settings.AllowContentAccess = true;
        web_view.Settings.DefaultTextEncodingName = "utf-8";
        web_view.Settings.SafeBrowsingEnabled = true;
        web_view.Settings.UseWideViewPort = true;
        web_view.SetWebViewClient(new HelloWebViewClient());
        web_view.LoadUrl("https://sample.com");
        web_view.Settings.SetPluginState(PluginState.On);
    }

I entered chrome and debug my code with the help of chrome://inspect/#devices. I didn't get any errors. what can I do?

0 Answers
Related