Save Google Slide as PDF using Google Apps Script

筅森魡賤 提交于 2020-06-26 05:03:51

问题


Is there a way to save a Google Slides as PDF file by using Google Apps Script?

I could only find solutions for saving Google Docs and Sheets.


回答1:


How about this sample script? When Google Docs (Spreadsheet, Document and Slide) is saved and/or downloaded using DriveApp.createFile(), the file format automatically becomes PDF. So we can use the following script.

Sample script :

var blob = DriveApp.getFileById("### Slide file ID ###").getBlob();
DriveApp.createFile(blob);

Note :

In this case, the filename of created PDF file is the same to the slide.

Edit :

If you want to copy the slide file, please use a following script.

var file = DriveApp.getFileById("### Slide file ID ###");
file.makeCopy(DriveApp.getFolderById("### Destination folder ID ###"));


来源:https://stackoverflow.com/questions/46819079/save-google-slide-as-pdf-using-google-apps-script

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