I have two printer connected to my computer. Can I select a specific printer by javascript code.
Asked
Active
Viewed 1.2k times
5
-
5Nope. Just think about the security/annoyance of that – Paul Dessert Jun 27 '13 at 17:21
-
1Possible duplicate: http://stackoverflow.com/questions/945691/automatically-print-image-from-website – Bad Wolf Jun 27 '13 at 17:21
-
1Maybe if you created your own browser. – Pitchinnate Jun 27 '13 at 17:21
-
What is your use case for this? If you need this functionality you are probably doing something wrong. – Bad Wolf Jun 27 '13 at 17:25
-
@BadWolf Well, it may be useful to print to a certain printer based on how far away you are. Such as in an office building of multiple levels. Instead of having to choose one, it just prints automatically based on proximity or where your device is located! – Shaz Jun 27 '13 at 17:29
2 Answers
4
Print options cannot be bypassed. Default printer is determined on the visitors OS. There is nothing you can do about it with plain old JavaScript. It might be possible with Flash or Java, but it would potentially cause loss of trust from your visitors.

Rob W
- 9,134
- 1
- 30
- 50
2
You can't, the browser won't allow it. This is in place to safeguard the printer from malicious printing by websites.
If you have a closed environment (like an intranet) you could print on the server side to a printer connected to a server. The exact details would depend on your server setup and you'd best discuss that with your local system administrator.

Janos Pasztor
- 1,265
- 8
- 16