【问题标题】:Display embedded doc / docx / pdf inside HTML using Google APIs使用 Google API 在 HTML 中显示嵌入的 doc/docx/pdf
【发布时间】:2017-01-14 11:21:36
【问题描述】:

假设我有指向它们的在线链接(即http://my.site.com/files/file_id_123423234),我无法显示 doc / docx / pdf 文档

我知道 Google 提供的 2 个替代方案是以下 2 个链接:

  1. http://docs.google.com/gview?url=[link_to_file]

    示例:
    http://docs.google.com/gview?url=http://my.site.com/files/file_id_123423234&embedded=true

  2. https://docs.google.com/viewerng/viewer?url=[link_to_file]

    示例:
    https://docs.google.com/viewerng/viewer?url=http://my.site.com/files/file_id_123423234&embedded=true

这两种替代方案并不总是能够成功地显示文档,并以“没有可用的预览”结束 http 调用:

您能否提供解决方案/替代方案?

【问题讨论】:

  • 您能否提供指向您从其中获得这些选项的 API 的链接?我正在使用 Docs Viewer 将文档嵌入到我的网站中,并且想知道还有哪些其他选项,例如 url 和 embed。
  • @karthikaruna,我没有找到任何 API 文档。 StackOverflow 中的示例

标签: google-api docx google-api-client google-docs-api doc


【解决方案1】:

您只需要使用嵌入式链接。为此,您必须按照Publish and embed Google Docs, Sheets, Slides & Forms 中的说明在网络上发布文件。

文件 -> 发布到网络。获取嵌入链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-18
    • 1970-01-01
    • 2018-03-08
    • 1970-01-01
    • 2018-01-26
    相关资源
    最近更新 更多