How to call the printer on a page made in ASP.NET MVC?

Asked

Viewed 485 times

0

I would like to call the printer even if the page is being accessed by mobile.

<div class="container droppedHover">

    <div class="row">
        <div class="span6">
            <button class="btn btn-lg btn-block btn-success glyphicon glyphicon-print" type="submit" >  Impressão</button>
            <a href="@Url.Action("Index", "MenuPrincipal")" class="btn btn-lg btn-block btn-warning glyphicon glyphicon-hand-left">
                Retorno
            </a>
        </div>
    </div>

</div>
  • For a long time you have been on the site, already know that if an answer answered the question hi ideal is to accept it. I’m not saying it’s the case, it might not suit you, but every time you solve the problem, you might. How about a review of all your questions with unacceptably answered answers to see which ones can be accepted? I’m not saying you should go around accepting everything, just what really solved your problem.

1 answer

4

Just create an event to open the print window:

<div class="container droppedHover">
    <div class="row">
        <div class="span6">
            <button class="btn btn-lg btn-block btn-success glyphicon glyphicon-print" type="submit" onClick="window.print()">  Impressão</button>
            <a href="@Url.Action("Index", "MenuPrincipal")" class="btn btn-lg btn-block btn-warning glyphicon glyphicon-hand-left">
                Retorno
            </a>
        </div>
    </div>
</div>

I put in the Github for future reference.

  • I’ll take a test, but if I’m accessing on a cell phone it will also work? I appreciate the help

  • I can’t say, do you have a printer connected to your phone? : ) When a person wants to print something they usually use the desktop. Cell phone is not a complete computer. Have to use the right tool for every thing.

  • as it is a system that can be accessed via mobile, so it is possible to send to the printer, every phone has this option, I will have to test to see if it will work because the command seems to be only windows

  • The fact that I can doesn’t mean I should.

Browser other questions tagged

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