Last active
October 20, 2019 09:40
-
-
Save GitHub30/a90fe9ef876f1a067b8db9715e6ed40e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function printHTML(html) { | |
const iframe = document.createElement('iframe') | |
iframe.hidden=true | |
document.body.appendChild(iframe) | |
iframe.contentDocument.open() | |
iframe.contentDocument.write(html) | |
iframe.contentDocument.close() | |
iframe.contentWindow.print() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment