Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the raw printer tray ID

Don Varuna
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I’m trying to find the printer tray ids of a particular printer. I have searched and found a lot of articles in Java using the PrintService, Media and MediaTray. Yet, this doesn’t provide a solution for my requirement. I will get the following output if I run the below code.

Win32 Printer : AL-M2010-3D8E02
Form-Source ID: 5 sun.print.Win32MediaTray
MP Tray ID: 6 sun.print.Win32MediaTray
Lower Cassette 1 ID: 7 sun.print.Win32MediaTray
Lower Cassette 2 ID: 8 sun.print.Win32MediaTray
Lower Cassette 3 ID: 9 sun.print.Win32MediaTray
Lower Cassette 4 ID: 10 sun.print.Win32MediaTray

If I run the following .net code I would get the following outpt.

Automatically Select 15
MP Tray 261
Lower Cassette 1 260
Lower Cassette 2 259
Lower Cassette 3 258
Lower Cassette 4 257

The above is what I want to achieve. I want to get the raw printer ID like 260, 259, 258 and so on through Java instade of 7,8,9,10. Is this possible in some way?

Thanks in advance.
The CD Man
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic