• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 662
  • Last Modified:

sharepoint - restrict printing

Is it possible to allow a user to view a web part page, but restrict their ability to print it?
  • 2
1 Solution
You could try the following:
<body onbeforeprint="return false" onprint="return false" onbeforecopy="return false" oncopy="return false" onbeforecut="return false" oncut="return false">

No matter what, you won't be able to prevent people from printing a webpage.  You might be able to *trick* them into thinking they cant, but ultimately, you can't interrupt printscreen.  

Here's some ways to trick them
*Register an event for onkeypress for the body (or document object).  Return false
*Display the "secure" content in a modal popup (probably the best option)
*Intercept the onbeforeprint event and turn everything white

Of course, people can turn off javascript and you're toast.  If you have a "do or die" security issue, generate a PDF with security features turned on.  

bytor38Author Commented:
The content that I'm trying to restrict is in a data view web part that I created showing sql data from a stored procedure.  I think that will keep me from the pdf option.  I'm not familiar with a modal popup, or if that will work with my data view query.

Do you know if those 2 options are a posibility?
PDF >> No unless you write some c# code
Model window YES, its basic javascript : window.showModalDialog("http://www.mywebsite.com","","dialogWidth:500px;dialogHeight:500px")


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now