We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


sharepoint - restrict printing

Medium Priority
Last Modified: 2012-05-06
Is it possible to allow a user to view a web part page, but restrict their ability to print it?
Watch Question

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.  

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


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")

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.