<p style= "" >
<p id= "to_print" ></p>
<input type= "button" id= "print_button" value= "Print" onclick= "document.getElementById('FILEtoPrint').focus(); document.getElementById('FILEtoPrint').contentWindow.print();" />
<script>
//浏览器预览打印
function printSome(path){ //传入文件路径
$( "#to_print" ).html( '<iframe src=' +path+ ' id="FILEtoPrint"></iframe>' );
setTimeout( function (){$( "#print_button" ).click();}, 500);
pagesetup_null();

//设置去除页眉页脚
function pagesetup_null() {
var hkey_root, hkey_path, hkey_key;
hkey_root = "HKEY_CURRENT_USER";
hkey_path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
try {
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key = "header";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
hkey_key = "footer";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
} catch (e) { }
}