简体   繁体   中英

how to display PDF links on other sites using OnSubmit Googleform and Iframe?

I'm having trouble creating a link that displays a PDF file from googledrive on an HTML page such as sites.google.com or etc by OnSubmit "George1234" in GoogleForm and then displaying a PDF file named George1234.PDF stored on google drive? while the existing script examples only display templates from Googlesheet

this is the sample script that make PDF from Googlesheet

<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>

so how to replace document location = to files PDF stored in GoogleDrive?? and 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>`;

Reference:

getId()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM