> Note that I have do an ugly array loop for this, instead of just extracting the AttributeSets with the get method. For example, if the user selects a media size like (in windows) "US Index Card 4x6", the statement; > > attributeSet.get(MediaSizeName.class); > > returns null. If you print all the values in the AttributeSet, you will note that the class in there is called sun.print.Win32MediaSize. > > For some reason, the get() call doesn't get the subclass, it expects an exact match of the class. Is this how the API is supposed to work?
No. But your code is wrong. The attribute class is Media, not MediaSizeName. The javadoc for Media.getCategory says : "For class Media and any vendor-defined subclasses, the category is class Media itself." Fix that and your code becomes much simpler. > > Another problem, but it seems minor to me, is that for some reason the calculated values are off by a few units from what is returned by say the PageFormat from pageDialog(). I seem to remember there was some minor rounding error somewhere. I think may have been corrected now, but should not cause problems anyway as the imageable area is more important to you. >I feel > kind of nervous about something like the page orientation. There are 4 > attribute values, but only 3 possible values in PageFormat (!). I don't see a problem. There's a reason ServiceUI.printDialog takes a DocFlavor parameter - so it can constrain the choices to the user based on the flavor the app intends to print to the service currently selected. The service won't report it supports reverse portrait anyway for Printable or Pageable so you will never get in that situation. -phil. =========================================================================== 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".
