0


I'm using the Microsoft Online Viewer ( http://products.office.com/en-us/office-online/view-office-documents-online ) to show documents inside my asp.net mvc website (in iframe). It allows to view word, excel and power point documents.

I've used a div over the viewer controls to disable users from clicking "save" and "print" options. The problem is when users press "Ctrl+P" inside the iframe it allow users to print the document.
Does anyone knows how to disable printing using the Microsoft Viewer? Some options I've tryed:

  • Accessing the iframe using Javascript and disable printing - I can't do that because the source of the iframe is from another domain and it generates the cross-origin exception.
  • Showing a transparent div over the viewer, so users couldn't click the iframe to press "Ctrl+P" - if users click the scrollbar then it focus the iframe and allow printing.

Is there any way to use this viewer or the onedrive viewer, disabling the print option?
Thank you.

-- edited --

I've found there's a parameter named wdPrint to disable printing. When I'm sharing the document it uses this parameter. I set wdPrint=0, but it's not working. I also couldn't disable the "Download" option on the context menu.
Here's my link: https://view.officeapps.live.com/op/embed.aspx?wdPrint=0&src=http%3A%2F%2Fmds.prodater.teresina.pi.gov.br%2Fdocs%2FModelo%2520Ata%2520Reuniao.docx

Thank you.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Diogo Arenhart
  • 407
  • 3
  • 8
  • 15
  • You can't give a user content and prevent them from saving or printing it. Also, you know a user can use dev tools to remove the transparent div you added, right? – Jason P Sep 11 '14 at 17:21
  • Thanks for your answer, Jason. Yes, I know them can use dev tools to remove the transparent div or see the source url of the iframe, but most of users don't know how to do this. They sure know using "Ctrl+P" to print. There's no problem if someone "hack" it. I'm just worried about most users. – Diogo Arenhart Sep 11 '14 at 17:28
  • There's also a download option in the menu in the bottom right hand corner of the screen, which worked for me when viewing your docx – JasonPlutext May 20 '15 at 02:17
  • Are you using cloud storage program by Microsoft for viewing-editing your documents? – lukai Nov 18 '19 at 04:39

0 Answers0