【发布时间】:2017-04-28 03:53:47
【问题描述】:
我的客户只需要查看办公室查看器(doc、docx、ppt 等)。我尝试在 java 中将 Docs 转换为 PDF(使用 apache poi 和 doc4j)并使用 pdf 查看器显示它。但结果并不是那么完美。转换后的 pdf 文件无法像在文档中那样正确呈现图像和表格。所以我想过在线使用 Microsoft Office 查看器并隐藏提供下载按钮和打印按钮的状态栏,因此只能查看。但我无法访问 iframe 中的 dom 元素。有没有更好的方法来处理这个问题或建议任何将办公文件转换为 pdf 或任何图像格式的解决方案。
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=https://calibre-ebook.com/downloads/demos/demo.docx' width='1366px' height='623px' frameborder='0'></iframe>
这是在 html 中嵌入 live office viewer 的代码。
我也试过了
<iframe id='resViewer' src='https://docs.google.com/viewer?url=https://calibre-ebook.com/downloads/demos/demo.docx&embedded=true' style='width: 700px; height: 700px;' frameborder='0'></iframe>
在这种情况下,我无法隐藏弹出按钮。我在堆栈溢出本身中引用了许多帖子,但没有一个对我有用。
【问题讨论】:
标签: javascript java jquery pdf iframe