浏览器以只读方式打开PDF

版权声明:本文为博主原创文章,欢迎转载。 https://blog.csdn.net/chengyuqiang/article/details/88828480

1、 pdf.js禁掉下载和打印的功能

<button id="print" style="display:none;" class="toolbarButton print hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
       <span data-l10n-id="print_label">Print</span>
</button>

 <button id="download" style="display:none;" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
       <span data-l10n-id="download_label">Download</span>
</button>

2 、解决快捷键ctrl+s

<script>
document.addEventListener("keydown", function(e) {
    if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
      e.preventDefault();
      e.stopPropagation();
    }
  }, false);
</script>
展开阅读全文

没有更多推荐了,返回首页