How to download Embedded Google Slide Presentations (published to the web)

Last Edit (18.03.2021)

Quickly to the point, I searched & failed to find a nifty way to save an embedded Google Slide Presentation last night. The only way that reportedly seems to work, didn’t work either.

So if you are in a hurry, all this involves is creating a couple of bookmarks.

Create a bookmark & name it ‘Open Google Slides’ & in the URL part, copy :

javascript:
var n = document.querySelectorAll('iframe[src*=docs\\.google]')[0],
k = document.createElement("a");
k.setAttribute("href",n.getAttribute("src"));
k.setAttribute("target","_blank");
k.setAttribute("style","display:block");
k.innerText = "Open Google Slides";
n.parentElement.insertBefore(k,n);

Similarly, Create another one & name it ‘Extract Slides’ with the URL part as:

javascript: 
var atag = "punch-viewer-content",
btag = "-caption",
ctag = "aria-setsize",
dtag = "aria-posinset",
msvg = document.getElementsByTagName("svg"),
node = document.querySelectorAll('[class$="' + btag + '"]')[0],
view = document.getElementsByClassName(atag)[0],
size = node.getAttribute(ctag),
data = "",
func = () => {
data += msvg[0].outerHTML;
if((i = node.getAttribute(dtag))==size) document.write(data);
else view.click(), setTimeout(func,10)
};
func()

Done. Now open the page with the embedded google slide & click the first bookmark. It should create a link “Open Google Slides” above the slides.

Clicking it should open the embedded presentation in a new tab. Now click the second bookmark. This should expand the page which you can simply save & use offline.

No plugins or apps. The next time you need to save an embedded presentation, simply use the two bookmarks.

The code snippets above are simple. The first one creates a link to the presentation & the second one expands the slides on the page, manually triggering the click on each slide.

Happy to hear if there is an easier way to do this in the comments.

Thanks for reading.

Founder @ Jetbrain Robotics