sharepoint - restrict printing

Posted on 2009-02-09
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?
Question by:bytor38
    LVL 9

    Accepted 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.  


    Author Comment

    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?
    LVL 9

    Expert Comment

    PDF >> No unless you write some c# code
    Model window YES, its basic javascript : window.showModalDialog("","","dialogWidth:500px;dialogHeight:500px")


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
    Experts-Exchange users below are the steps you can follow to upgrade your Lync server to latest CU's or cumulative updates. Note: Perform it during non-production hours.   Step 1: Backup your lync and SQL server database. Follow below article: h…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now