Thanks Phil. Now it's working. (I stumbled upon a way to make this work about a year ago, but for some reason, I couldn't remember how to do it. Probably age.)
BTW - The MediaRequested reference was caused by me doing a little editing in the original post, without compiling. I was starting to get sleepy and delirious, i.e, careless, when I posted. Thanks again, Steve Sinai Phil Race wrote: > > You almost had it. For some reason you aren't properly using the answer > ("Object [] res") you got from the service, > so you are only seeing the first of the list. And I'm not sure where you > got MediaRequested from, that > should not compile as there's no such class. > > That should be > Media[] res = (Media[])getSupportedAttributeValues(Media.class, null, > null); > > Then print each of the elements of "res". > > -phil. > > ssinai wrote: >> Given a print service from something like >> >> PrintService defaultPrintService = >> PrintServiceLookup.lookupDefaultPrintService() >> >> is there a way to query the default print service to get the paper sizes >> that print service (printer) can handle? For example, I'd like to get a >> list back containing things like "Legal", "Letter", "A4", "A5", "B4", >> etc. >> >> I'm fiddling around with the following code... >> >> PrintService defaultPrintService = >> PrintServiceLookup.lookupDefaultPrintService(); >> Object [] res = (Object >> [])defaultPrintService.getSupportedAttributeValues(Media.class, null, >> null); >> MediaRequested mr = (MediaRequested)res[0]; >> System.out.println("mr="+mr); >> >> and the final result is "mr=na-letter". >> >> I was hoping I'd get a list of legal paper sizes. Is this even >> possible? >> >> Thanks. >> > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > of the message "signoff JAVA2D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". > > -- View this message in context: http://www.nabble.com/Querying-paper-sizes-for-a-printer-tp18254676p18266184.html Sent from the Sun - Java2D-Interest mailing list archive at Nabble.com. =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".