如何在没有打印预览窗口的情况下打印 [英] How to Printing Without Print Preview Window

查看:78
本文介绍了如何在没有打印预览窗口的情况下打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 javascript 在 onclick 事件上调用打印函数.

I am calling print function on onclick event with javascript.

    <input type="button" value="Print" onclick="window.print()" />

我使用此代码打印页面,但我想通过打印预览"窗口.

I use this code for printing a page but i want to pass 'print preview' window.

如何在不打开打印对话框的情况下直接打印到默认打印机.

How to print directly to default printer without opening dialog box of print.

推荐答案

VISIT MY PAGE WWW.......

VISIT MY PAGE WWW.......

(用户点击)

科博姆!打印了 100 页.

KOBOM! 100 pages printed.

这不应该是可能的,因为否则这将是一个安全问题(这种情况下;垃圾邮件).您的代码涉及 I/O 通信,这通过浏览器进行(一切都通过浏览器进行,但在这里它们从您的代码中进行控制).你实际上做对了,但是你选择的浏览器决定弹出一个对话框,等待用户接受打印命令.

It should not be possible because it would otherwise be a security issue(this case; spam). Your code involves I/O-communcation and this goes via the browser(everything goes through the browser but here they take control from your code). You are actually doing it right, but the browser you have chosen have decided to popup a dialog box and wait for the user to accept the print command.

好吧,浏览器设计者希望为他们的用户提供良好的用户体验,这样他们就可以防止潜在的垃圾邮件.Javascript 知道这一点,这就是为什么在打印机函数中没有此参数的原因.

Well,the browser designer wants a good user experience for their users and in this way they prevent potential spam. Javascript knows it and thats why there is no parameters for this in the printer function.

你还想做吗?尝试为您当前的浏览器查找附加组件或调整以允许此类绕过.创建您自己的应用程序(可以是浏览器).

You still want to do it? try to find an add-on or a tweak for your current browser to allow such bypasses. Create your own application(could be a browser).

这种方法有问题吗?你不想让其他用户安装或配置这些东西;对于普通用户来说太多了,而您的目的是让事情变得更简单.

Issue with this approach? You dont want to ask other users to install or configure such things; Too much for the average user and your intent was to make things easier.

这篇关于如何在没有打印预览窗口的情况下打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆