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?
Simple Solution:
UrlFetchApp