【问题标题】:Hide pdf toolbar in firefox while displaying pdf using iframe在使用 iframe 显示 pdf 时在 Firefox 中隐藏 pdf 工具栏
【发布时间】:2023-03-08 02:05:01
【问题描述】:

我正在使用 iframe 在浏览器中显示一个 pdf 文件。它工作正常,但我想禁用/隐藏 acrobat 工具栏(下图)。

我尝试了#toolbar=0&statusbar=0 的解决方案,它在 chrome 上运行良好,但在 Firefox 上不运行。我怎样才能做到这一点?

【问题讨论】:

  • 您对此有什么解决方案吗...?
  • 您好,您对此有什么解决办法吗?

标签: javascript firefox iframe toolbar acrobat


【解决方案1】:

对于任何搜索的人,这里有来自用户 jscher2000 (https://support.mozilla.org/en-US/user/jscher2000) 的答案 https://support.mozilla.org/en-US/questions/1119523

#outerContainer #mainContainer div.toolbar {
  display: none !important; /* hide PDF viewer toolbar */
}
#outerContainer #mainContainer #viewerContainer {
  top: 0 !important; /* move doc up into empty bar space */
}

【讨论】:

  • 这不是您可以添加到页面的 CSS。必须添加到浏览器的userContent.css文件中
【解决方案2】:

浏览器处理 PDF 打开参数的方式不同(如果有的话)。如果浏览器供应商没有为其构建 API,则 Javascript 无法强制浏览器支持 PDF 打开参数。

【讨论】:

    猜你喜欢
    • 2013-05-04
    • 2021-08-31
    • 2016-08-11
    • 2011-05-29
    • 1970-01-01
    • 2015-12-11
    • 2023-03-26
    • 2017-08-12
    • 1970-01-01
    相关资源
    最近更新 更多