如何隐藏pdf组件中的下载和打印按钮?

如何隐藏pdf组件中的下载和打印

阅读 423
1 个回答
✓ 已被采纳

1、下载pdf.js查看器,推荐兼容性比较好的版本pdf.js

2、把build、web文件夹拷贝到public文件夹下面

3、预览pdf

<iframe :src="'/web/viewer.html?file=' + '文件流'" width="100%" height="100%" id="embed" />

4、隐藏下载打印按钮
直接修改源码

 <button id="secondaryPrint" class="secondaryToolbarButton print visibleMediumView" title="Print" tabindex="53" data-l10n-id="print" style="display: none;">
  <span data-l10n-id="print_label">Print</span>
</button>

<button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download" style="display: none;">
  <span data-l10n-id="download_label">Download</span>
</button>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏