Printing documents from a web page

G

Guest

I have a section of my site with some fairly hefty backgrounds, and have
created some printer-friendly documents for those visitors who wish to print
the information.

I want to have a button on my web page that opens up a document - configured
for easy printing - and automatically prints it. I can create the button to
open the document, but cannot automatically print it. It would also be useful
if the page closed automatically after printing.

Thanks.
 
G

Guest

Generally, you're best off letting the Web visitor click the browser's Print
button. This is because not all browsers support printing the same way, or at
all.

Think about it. How'd you like to visit some Web site and have it print
advertising on your printer without requiring any action on your part?

As to making the window close, a window.close() JavaScript will do that. But
it many cases, it will also raise a warning message informing the Web visitor
that the page is trying to close itself, and asking if that's OK. This is
because of certain nasty sites that used to close their window before you had
a chance to figure out who just trashed your computer. But it's also
confusing to your visitors.

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
A

Andrew Murray

This is for a normal grey form button

<input type="button" name="Print" Value="Print this page"
onclick='window.print();'>

or similar for a text link to print the page:

<a href="#" onclick='Window.print();'>Print this page</a>
 

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

Top