Created
February 27, 2012 19:45
-
-
Save thiyagaraj/1926568 to your computer and use it in GitHub Desktop.
Print part of a webpage based on id
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
var printPage = function(id){ | |
var html="<html><head><title>Print page</title>"; | |
html+="</head><body>" | |
html+= document.getElementById(id).innerHTML; | |
html+="</body></html>"; | |
var printWin = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status =0'); | |
printWin.document.write(html); | |
printWin.document.close(); | |
printWin.focus(); | |
printWin.print(); | |
printWin.close(); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment