Printing

  • Thread starter Thread starter Mark S.
  • Start date Start date
M

Mark S.

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

function Printit()
{
window.print();
}

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

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

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

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
 
Back
Top