简体   繁体   中英

How to Printing Without Print Preview Window

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.......

(USER CLICKS)

KOBOM! 100 pages printed.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM