Printpreviewdialog in the browser

Asked

Viewed 27 times

0

I have the following code in a MVC project inside a cshtml:

                var w = window.open('', "print", "height=400,width=600");
                w.document.write(json.html);
                w.document.close();
                w.setTimeout(w.print, 1000);

It does everything I need, opens a print tab, and prints what’s inside "json.html"..

I need to do the same thing, but in VB.Net, and I’m having a lot of difficulty opening the print tab, all I got so far was to open a blank tab as follows:

Page.RegisterClientScriptBlock("Imprimir", "<script>window.open('', '_blank', 'width=600, height=400');</script>")

My question is: how do I open this print screen? and how do I edit the content that will be written on the print page?

Grateful!

1 answer

0

I believe that the right command is this, in case someone has the same doubt:

Page.Registerclientscriptblock("Print", "window.print();")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.