AnsweredAssumed Answered

Disable print from browser and printscreen

Question asked by ankurkhandelwal on Jan 9, 2013
Hi To All,

I am working on Alfresco 3.4.

I want to disable print option from browser of document details page.
I have added following code in my document-details-min.js file for the same.

But it is not working.

   if(results[0].ilNonPrintableNonSaveable == "true"){
   this.loadingPanel1 = new yuiLoadingPanel();"Information");
   var inlineMediaStyle = null;
   var bodyId = document.getElementById("Share");
   bodyId.setAttribute("onBeforePrint", "'visible'");
   bodyId.setAttribute("onAfterPrint", "'hidden'");
   var head = document.getElementsByTagName('head')[0];
   var newStyle = document.createElement('style');
   newStyle.setAttribute('type', 'text/css');
   newStyle.setAttribute('media', 'print');
   newStyle.appendChild(document.createTextNode('body { visibility: hidden !important; display: none !important; }'));
   if (inlineMediaStyle != null){head.replaceChild(newStyle, inlineMediaStyle)
   inlineMediaStyle = newStyle;

Can anybody suggest where I am wrong.

Also I want to disable printscreen for the document details page.
Any suggestions for that will also be helpful.

Ankur Khandelwal