Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable the Print Function

Status
Not open for further replies.

DanRum

MIS
Jul 20, 2001
15
US
I need to disable the print function on certian pages on my site. It is an intranet and I have all the pages that need no printing in its own site. I need to disable on the pages on one site and allow the to print on another.

Any help will be great.
 
There might be an easy way to do this but I don't know any. What you could do would be to use media style sheets. Do something like - have all your code in a div and use a print media style sheet to hide the div. That way, when someone tries to print the page, all that will print will be an empty page.

You could also have a second div that contains a message - "You do not have permission to print this page". Set up two media styles. Screen view will show the first div and print view will print your message.

I have this working on one of my pages as follows:
<STYLE>
@media print {
#screenView {display: none;}
#printView {display: block;}
#TOP {display: none;}
#BOTTOM {display: none;}
}

@media screen {
#screenView {display: block;}
#printView {display: none;}
#TOP {display: block;}
#BOTTOM {display: block;}
}
</STYLE>

For the screen view, four DIV's are visible. However, when the user tries to print the page, it only prints one of the DIV's.

Hope that helps. Mise Le Meas,

Mighty :)
 
There might be an easy way to do this but I don't know any. What you could do would be to use media style sheets. Do something like - have all your code in a div and use a print media style sheet to hide the div. That way, when someone tries to print the page, all that will print will be an empty page.

You could also have a second div that contains a message - &quot;You do not have permission to print this page&quot;. Set up two media styles. Screen view will show the first div and print view will print your message.

I have this working on one of my pages as follows:
<STYLE>
@media print {
#screenView {display: none;}
#printView {display: block;}
#TOP {display: none;}
#BOTTOM {display: none;}
}

@media screen {
#screenView {display: block;}
#printView {display: none;}
#TOP {display: block;}
#BOTTOM {display: block;}
}
</STYLE>

For the screen view, three DIV's are visible. However, when the user tries to print the page, it only prints one of the DIV's.

Hope that helps. Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top