Save one Google Slide as pdf with Google Apps Script while preserving the format

52 Views Asked by At

The solution provided in this answer is correct but in my experience, a slide in 4:3 format will be saved as a pdf in the 16:9 format, which scrambles the contents.

How can I save a Google Slide to pdf and make the output pdf preserve the original slide format?

1

There are 1 best solutions below

5
On

Simple Solution:

function SaveAsPDF() {
  var googleSlidesId = "#############################" //replace with presentation id
  var slidesBlob = UrlFetchApp.fetch("https://docs.google.com/presentation/d/"+googleSlidesId+"/export?format=pdf").getBlob();
  var pdf = DriveApp.createFile(slidesBlob);
  Logger.log(pdf.getUrl());
}

UrlFetchApp