在谷歌浏览器 Chrome 打印时 能不能不预览 直接调用系统对话框直接打印

双鱼达摩 2014-08-28 11:51:11
因项目需要做打印功能
用到JavaScript 调用打印 主要是用print() 方法
但是在谷歌Chrome 浏览器上用 会有预览功能
在操作上变繁琐了
看到谷歌浏览器上有提示 按 Shift+Ctrl+P 可以调用 系统对话框进行打印

我现在想问的是 js 是否可以直接调出这个系统对话框 进行打印
而不经过预览的那个步骤

...全文
4661 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjfsoft 2016-11-03
  • 打赏
  • 举报
回复
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk-printing
双鱼达摩 2014-08-28
  • 打赏
  • 举报
回复
引用 1 楼 yukon12345 的回复:
我用js的按键触发弄了下,结果,不行 给个思路
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
    <script>
$(function(){


        $('#print').bind('click',function(){
            console.log("start")
            e = jQuery.Event("keydown");
            e.keyCode= 112; //enter key
            e.ctrlKey=true;
            e.shiftKey=true;
            $(document).trigger(e);
            console.log("end")
        })
    $(document).keydown(function(e){
        console.log(e.keyCode)
        console.log(e.ctrlKey)
        console.log(e.shiftKey)
    })
})
    </script>
</head>
<body>
<button id="print">狠戳chrome打印</button>
<input type="text" id="t">
</body>
</html>
先谢谢了 我试试看
步慢生错 2014-08-28
  • 打赏
  • 举报
回复
我用js的按键触发弄了下,结果,不行 给个思路
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
    <script>
$(function(){


        $('#print').bind('click',function(){
            console.log("start")
            e = jQuery.Event("keydown");
            e.keyCode= 112; //enter key
            e.ctrlKey=true;
            e.shiftKey=true;
            $(document).trigger(e);
            console.log("end")
        })
    $(document).keydown(function(e){
        console.log(e.keyCode)
        console.log(e.ctrlKey)
        console.log(e.shiftKey)
    })
})
    </script>
</head>
<body>
<button id="print">狠戳chrome打印</button>
<input type="text" id="t">
</body>
</html>

87,921

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧