Discussion in 'ASP .Net' started by Mark S., Aug 3, 2003.

  1. Mark S.

    Mark S. Guest

    Hello everyone.
    I have this web site created in I'm using this simple javascript
    to print

    function Printit()

    Now is there anyway in that function to automaticly select the default
    printer, set the margins and make sure printing background colors is on. oh
    and hide the image that you click on to print the page

    Mark S., Aug 3, 2003
    1. Advertisements

  2. Mark S.

    Jerry III Guest

    Hiding an image is fairly simple - just set it's display (or visibility)
    style for print @media rule. Like this:

    <title>Print page</title>
    <style type="text/css>
    @media print {
    #printbtn { visibility: hidden; }
    <a href="javascript:window.print()" id="printbtn">Print</a>

    As for selecting the default printer and all the other stuff: No. ASP pages
    are not WinForms applications (no matter how much certain ppl want them to
    be) and there are things you just can't do. Unless you do want to install an
    actual application on the client side, such as an ActiveX control that will
    do the printing for you (but then you can't simply use window.print() but
    you'd have to do the printing yourself).

    Jerry III, Aug 3, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.