Last active
January 25, 2018 18:14
-
-
Save sayham-sjb/67d6b67a0db6e861bedd3198cc025ec4 to your computer and use it in GitHub Desktop.
HowToPrintContentsFromCertainDIV_printSpecificDiv1 #js #VS
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 printSpecificDiv(divId) { | |
var printContent = document.getElementById(divId); | |
var windowUrl = 'about:blank'; | |
var windowName = 'Print' + new Date().getTime(); | |
var printWindow = window.open(windowUrl, windowName, | |
'left = 10000, top = 10000, width = 0, height = 0'); | |
printWindow.document.write(printContent.innerHTML); | |
printWindow.document.close(); | |
printWindow.focus(); | |
printWindow.print(); | |
printWindow.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment