如何在其他网站上显示PDF链接使用OnSubmit Googleform和Iframe?



在OnSubmit "George1234"等HTML页面上创建显示来自googledrive的PDF文件的链接时遇到了问题。在GoogleForm,然后显示一个名为George1234.PDF存储在谷歌驱动器?而现有的脚本示例只显示来自Googlesheet

的模板这是一个从googleesheet生成PDF的示例脚本

<iframe id="gform" src="https://docs.google.com/forms/d/e/NEWFORMID/viewform?embedded=true" width="640" height="427" frameborder="0" marginheight="0" marginwidth="0">Loading..</iframe>

HTML

<iframe 
User File 
</iframe>
<script type="text/javascript">
var load = 0;
document.getElementById('gform').onload = function() {
load++;
if(load > 1) {
document.location = "https://docs.google.com/spreadsheets/d/ ID_SPREADSHEET /export?Format=pdf&format=pdf&size=8&gid= GID_PRINTED &gridlines=false";
}
}
</script>

那么如何替换文档位置=文件PDF存储在GoogleDrive??和base OnSubmit Name George1234

const id = file.getId();
const html= `<iframe src="https://drive.google.com/file/d/${id}/preview" width="640" height="480" allow="autoplay"></iframe>`;

参考:

getId ()

最新更新