4 回答

TA貢獻1824條經驗 獲得超5個贊
您需要執行以下操作才能立即啟用Firefox,而無需顯示“打印首選項”對話框。
在Firefox的位置欄中鍵入about:config,然后按Enter。
右鍵單擊頁面上的任意位置,然后選擇“新建”>“布爾值”
輸入首選項名稱作為print.always_print_silent,然后單擊確定。
我發現在某個地方,這對我有幫助

TA貢獻1934條經驗 獲得超2個贊
正如@Axel所寫,Firefox具有print.always_print_silent選項。
對于Chrome,請使用--kiosk-printing
選項跳過“打印預覽”對話框:
編輯用于啟動Chrome的快捷方式,然后添加“ --kiosk-printing”,然后重新啟動Chrome。
注意:如果不起作用,很可能是因為您沒有完全停止Chrome,注銷并重新登錄肯定可以解決問題。

TA貢獻1982條經驗 獲得超2個贊
您可以嘗試以下兩個代碼示例:
1:
<script>
function Print() {
alert ("THUD.. another tree bites the dust!")
if (document.layers)
{
window.print();
}
else if (document.all)
{
WebBrowser1.ExecWB(6, 1);
//use 6, 1 to prompt the print dialog or 6, 6 to omit it
//some websites also indicate that 6,2 should be used to omit the box
WebBrowser1.outerHTML = "";
}
}
</script>
<object ID="WebBrowser1" WIDTH="0" HEIGHT="0"
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
2:
if (navigator.appName == "Microsoft Internet Explorer")
{
var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = "";
}
else {
window.print();
}
您可能需要將要測試的站點/頁面添加到本地Intranet區域。
添加回答
舉報