Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Printer tray selection from Javascript

 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.. i have a printer with A4 size paper in tray 3 and A5 sized paper in Tray 2.. now i want to select printer tray from javascript while printing so that specific pages are printed in A4 and A5.

Can anybody suggect me how do i do this in javascript. I am using media print in html to print the content of div...

 
author & internet detective
Posts: 39574
781
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't a person specify this when the print dialog comes up? How does the web page know how all user's printers are configured?
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne - I think you are understating this. I believe that the browser's sandbox should block any access attempts to any hardware.

Ruquia - this may be frustrating for you, but imagine this from a blackhat perspective. There are websites you can go to know that pop up lots of annoying (to say the least) web pages. Or do pop-under sites. Now imagine how much more frustrating it would be if you were to go to a web page and suddenly find that your company's printer is printing thousands of pages of advertisements. Or that the page had told to your printer to reconfigure itself in some way that the printer did not understand, and your printer is no longer working.

So - no access to the printer from within Javascript.
 
Jeanne Boyarsky
author & internet detective
Posts: 39574
781
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Andrew Monkhouse wrote:Jeanne - I think you are understating this. I believe that the browser's sandbox should block any access attempts to any hardware.


Yes. I was trying to subtly hint that it wasn't possible with JavaScript. The browser absolutely prevents this.

It might be possible with ActiveX, but that's only in IE and only if the user allows ActiveX to run.

[edited to fix quoting]
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As said by jeanne that its possible in Active X... can anybody give me an example of ActiveX.. when user clicks print button the page should get printed to a particular tray like Tray2.
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ActiveX ... can you afford to exclude everyone who is not running one particular browser on one particular operating systems AND whose security level is set low enough to allow this? While it may be possible, it won't work for many people.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this is a small application just used in my office alone.. i need to any how show the result to my boss.. can you please suggest me an example of Active X
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!