【发布时间】:2020-01-21 16:51:00
【问题描述】:
大家早上好。我编写了一个简短的脚本,它根据电子表格中的行批量创建 [单页] Google 幻灯片。在每次创建的循环中,我想在 Google Drive 中创建幻灯片的 PNG(或在用户桌面上下载)。这些图片的规格应该与用户单击“文件”>“下载”>“PNG”的规格相同——沉重的小文本需要完整的投影仪高清——所以我不相信我可以使用“缩略图”功能,它看起来仅限于 1600 像素。
我下面的代码生成错误“不支持从 text/html 转换为 image/png” - 所以我不确定这是 API 的限制还是我的编码有问题。提前谢谢你。
var options =
{
"contentType" : "image/PNG"
};
var url = 'https://docs.google.com/presentation/d/' + presentationCopyId + '/export/PNG';
var response = UrlFetchApp.fetch(url, options);
var image = response.getAs(MimeType.PNG);
image.setName(SlideName);
DriveApp.createFile(image);
【问题讨论】:
标签: google-apps-script google-slides-api google-slides