Printing A Document On Load

document.body.onload=function(){document.body.offsetHeight;window.print()};