Skip to content

Instantly share code, notes, and snippets.

@jlewin
Created September 27, 2025 07:07
Show Gist options
  • Save jlewin/d2f18a0907531904e9b1b5dea70bdc8e to your computer and use it in GitHub Desktop.
Save jlewin/d2f18a0907531904e9b1b5dea70bdc8e to your computer and use it in GitHub Desktop.
Open embedded youtube videos in Canvas to print to pdf
// These embedded links have full transcripts but print to pdf can't get at the content. Opening into a dedicated non-iframe window
// and clearing the fixed height, removes scrollbars and allowing print to pdf to work as expected
function openAllFrames() {
var iframes = Array.from(document.querySelectorAll('#content-wrapper iframe'));
iframes.forEach(function(f) {
window.open(f.src, "_blank");
});
}
// Create clickable action item
var text = document.createElement('h1');
text.textContent = 'Open All Frames';
text.addEventListener('click', openAllFrames);
const contentWrapper = document.querySelector('#content-wrapper');
contentWrapper.insertBefore(text, contentWrapper.firstChild);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment