Printing

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
 
J

Jerry III

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top