Print Button In Webview RRS feed

  • Question

  • Hi,

         I have web mobile application, at the button in aspx page i put the below code to print the page, it is working fine in browsers (all)  but when i put my application inside webview in android it not working (not response after click)

    <div id="options">

    <input id="printpagebutton" type="button" class="printToprinter" value="PRINT" onclick="printpage()" />


    function printpage() {

        //Get the print button and put it into a variable
        var printButton = document.getElementById("printpagebutton");

        //Set the button visibility to 'hidden' 
        printButton.style.visibility = 'hidden';

        //Print the page content

        //Restore button visibility
        printButton.style.visibility = 'visible';



    • Moved by CoolDadTx Thursday, February 27, 2020 3:09 PM ASP.NET related
    Friday, February 21, 2020 10:47 PM

All replies

  • Your best place to ask is here


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Friday, February 21, 2020 11:37 PM
  • The bellow link explicitly says "You cannot use JavaScript in a HTML document to trigger printing", 
    and provides an example of how to use the Java API. Chrome for Android (at least Beta) supports window.print().
    Saturday, February 22, 2020 6:50 AM
  • I want to print from my aspx page depend on id so from java itself cannot be done How to add print button to open printer dialogue, i used driver.google. But it return blanc after press print
    Saturday, February 22, 2020 6:14 PM
  • i did all the above code and it is failed inside Webview, it is working fine through browser :

            HttpContext.Current.Response.Expires = 0;
            HttpContext.Current.Response.Buffer = true;
            HttpContext.Current.Response.AddHeader("Content-Disposition", "Attachment;FileName="+outletid+ "Check.pdf");
    HttpContext.Current.Response.ContentType = "application/force-download";//Application/pdf


     Process process = new System.Diagnostics.Process();
      process.StartInfo.FileName = "chrome";
      process.StartInfo.Arguments = openurl + " --new-window"; 


      string UrlForAndroid = "http://drive.google.com/viewerng/viewer?embedded=true&url="+openurl;

    this.Page.Response.Redirect(UrlForAndroid, true);

    this option open the pdf, but when i try to print it return white page
    Sunday, February 23, 2020 9:07 PM
  • Hi ikrami Sami,
    I viewed your description, it is mainly related to ASP.NET. So it is recommended to go to this forum and you can get more professional answer.
    Thank you for your understanding.
    Best Regards,
    Daniel Zhang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 26, 2020 7:47 AM