从客户端IE静默打印 [英] Silent Print From Client side IE
问题描述
我尝试通过javascript从浏览器打印pdf。
打印对话框盒子。我试图跳过这个对话框,但没有这样做。
i尝试了几个代码,比如
1 - //这也打开了对话框
Hi,
I tried print pdf from browser via javascript.
it prints with dialog box . i tried to skip this dialog box but failed in doing so.
i tried several codes like
1 -- // this also opens dialog box
function print1()
{
if (navigator.appname == "microsoft internet explore")
{
var printcommand = '<object id="printcommandobject" width=0 height=0 classid="clsid:8856f961-340a-11d0-a96b-00c04fd705a2"></object>';
document.body.insertadjacenthtml('beforeend', printcommand);
document.all.printcommandobject.execwb(6,-1);
printcommandobject.outerhtml = "";
}
else {
window.print();
}
}
</script>
<button onclick=print1()>Try it</button>
2-this is second code which i tried
<script>
function btn_print_onclick() {
factory.printing.header = "This is MeadCo";
factory.printing.footer = "Printing by ScriptX";
factory.printing.portrait = false;
factory.printing.leftMargin = 1.0;
factory.printing.topMargin = 1.0;
factory.printing.rightMargin = 1.0;
factory.printing.bottomMargin = 1.0;
factory.printing.Print(false);
}
</script>
</head>
<body>
<button onclick="btn_print_onclick()">Print report</button>
</body>
3 - 也尝试了一些链接,但它们也不适用于我
http://forums.asp.net/t/1364879.aspx?Avoid+Print+dialog+box+while+printing+webpage
http:// www .webdeveloper.com / forum / showthread.php?174029.html
http://justtalkaboutweb.com/2008/05/09/javascript-print-bypass- printer-dialog-in-ie-and-firefox /
http://scriptx.meadroid.com/community-support/community-forum/general/2014/ 1 / the-problem-of-scriptx-in-ie8.aspx
http://codeverge.com/asp.net .getting起动/ AVO id-print-dialog-box-while-printing / 726740
https://gist.github.com/cchitsiang/7349218
http://www.codeproject.com/Questions/784656/Printing-in-one-click-I-dont-want-print-setup-dial
任何帮助将不胜感激。
谢谢
Sushil
3 - also tried some links but they also didn't work for me
http://forums.asp.net/t/1364879.aspx?Avoid+Print+dialog+box+while+printing+webpage
http://www.webdeveloper.com/forum/showthread.php?174029.html
http://justtalkaboutweb.com/2008/05/09/javascript-print-bypass-printer-dialog-in-ie-and-firefox/
http://scriptx.meadroid.com/community-support/community-forum/general/2014/1/the-problem-of-scriptx-in-ie8.aspx
http://codeverge.com/asp.net.getting-started/avoid-print-dialog-box-while-printing/726740
https://gist.github.com/cchitsiang/7349218
http://www.codeproject.com/Questions/784656/Printing-in-one-click-I-dont-want-print-setup-dial
any help will be appreciated.
Thanks
Sushil
推荐答案
无法在客户端计算机上静默打印 - 否则我会立即在本地打印机上打印战争与和平!!!
There is no way to print silently on client machine - otherwise I would print the 'War and Peace' on your local printer right now!!!
这篇关于从客户端IE静默打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!