使用Google Apps脚本将Google幻灯片另存为PDF [英] Save Google Slide as PDF using Google Apps Script
问题描述
是否可以使用Google Apps脚本将Google幻灯片另存为PDF文件?
Is there a way to save a Google Slides as PDF file by using Google Apps Script?
我只能找到保存Google文档和表格的解决方案.
I could only find solutions for saving Google Docs and Sheets.
推荐答案
该示例脚本如何?使用DriveApp.createFile()
保存和/或下载Google文档(电子表格,文档和幻灯片)后,文件格式将自动变为PDF.因此,我们可以使用以下脚本.
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.
var blob = DriveApp.getFileById("### Slide file ID ###").getBlob();
DriveApp.createFile(blob);
注意:
在这种情况下,创建的PDF文件的文件名与幻灯片相同.
Note :
In this case, the filename of created PDF file is the same to the slide.
如果要复制幻灯片文件,请使用以下脚本.
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 ###"));
这篇关于使用Google Apps脚本将Google幻灯片另存为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!