使用Google API在HTML中显示嵌入式doc / docx / pdf

时间:2017-01-14 11:21:36

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

我在显示doc / docx / pdf文档时遇到问题,假设我有一个在线链接(即http://my.site.com/files/file_id_123423234

2备选方案我知道Google提供以下两个链接:

  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

  3. 两种选择并不总是设法成功显示以“无预览可用”结束http呼叫的文档: enter image description here

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

1 个答案:

答案 0 :(得分:0)

您只需要使用嵌入式链接。为此,您必须按照Publish and embed Google Docs, Sheets, Slides & Forms

中的说明在网络上发布文件

档案 - >发布到Web。获取嵌入链接。

相关问题