I'm a bit new to this, so I apologize in advance for any newb related annoyances.
What I'm trying to do is create a google presentation with various images, and then download each slide as a separate pdf. I'm trouble with the downloading as a pdf part. The presentation is being constructed correctly. I've tried a couple different things, but haven't found a working solution yet. The simplest one I tried was:
var newFolder=rootFolder.createFolder(sourceSpreadsheet.getName() + ' - Functionals').setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
var deck = SlidesApp.create(NAME); // name determined separately
var presentationID = deck.getId();
...
var blob = DriveApp.getFileById(presentationID).getBlob();
newFolder.createFile(blob);
This did create a pdf, but it looks like it was just one blank page. I'm unsure if maybe it needs to run on each slide individually rather than the presentation as a whole. I couldn't find anything to indicate that to be the case though.
The second thing I tried was based on a similar solution I found for a spreadsheet. I don't really understand how changing the URL downloads it as a pdf, and maybe that's related to the issue with it, which is this is resulting in a 404.
var presentation = SlidesApp.openById(presentationID);
var url = presentation.getUrl();
url = url.replace(/edit$/,'');
var url_ext = 'export?exportFormat=pdf&format=pdf' + '&muteHttpExceptions=true' //export as pdf
var response = UrlFetchApp.fetch(url + url_ext, {
headers: {
'Authorization': 'Bearer ' + token
}
});