Display PDF viewer inside the Google Apps Script Dialog

我们两清 提交于 2021-02-04 08:21:20

问题


I want to display a PDF inside a Dialog of a Google Spreadsheet Add-on Dialog.

more about apps script dialog can be found here

https://developers.google.com/apps-script/guides/html/

<iframe id="iframe" src="https://www.w3docs.com/uploads/media/default/0001/01/540cb75550adf33f281f29132dddd14fded85bfc.pdf"  frameborder="0" height="500px" width="100%"></iframe>

When I inspect, I see the message Resource interpreted as Document but transferred with MIME type application/pdf: "https://www.w3docs.com/uploads/media/default/0001/01/540cb75550adf33f281f29132dddd14fded85bfc.pdf".


回答1:


Answer:

You can embed the Google viewer to display the PDF using an <iframe>.

Code:

<iframe src="https://docs.google.com/viewer?url=https://www.w3docs.com/uploads/media/default/0001/01/540cb75550adf33f281f29132dddd14fded85bfc.pdf&embedded=true" height="1080" width="1920"></iframe>

Just make sure to change the height and width attributes of the <iframe>.



来源:https://stackoverflow.com/questions/57203813/display-pdf-viewer-inside-the-google-apps-script-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!