On 22.11.2013 00:15, Phil Race wrote:
The other problem you mention is largely if not entirely because IPP lumped
trays along with papers as being "Media".

See http://tools.ietf.org/html/rfc2566#section-4.2.11

   If a Printer object supports a medium name as a value of this
   attribute, such a medium name implicitly selects an input-tray that
contains the specified medium. If a Printer object supports a medium
   size as a value of this attribute, such a medium size implicitly
   selects a medium name that in turn implicitly selects an input-tray
   that contains the medium with the specified size.  If a Printer
object supports an input-tray as the value of this attribute, such an
   input-tray implicitly selects the medium that is in that input-tray
   at the time the job prints.

If I understand this correct, that means it should be possible to just define a MediaTray without a MediaSizeName then right? But in my environment the default MediaSizeName is set to Letter even though the current PrintService would define A4 as the default.

I see a line in RasterPrinterJob.java which might cause that to happen if you specify a tray and no paper but that seems like its a bug. It should always be the default for the current printer unless I'm forgetting something we had to do for backwards compatibility.

Do you mean this lines starting at 562:

        Media media = (Media)attSet.get(Media.class);
        if (media == null) {
            media =
(Media)service.getDefaultAttributeValue(Media.class);
        }
        if (!(media instanceof MediaSizeName)) {
            media = MediaSizeName.NA_LETTER;
        }

This would replace a set MediaTray from the attribute set with the MediaSizeName.NA_LETTER right? A would sugest to change the lines to something like this:

        Media media = (Media)attSet.get(Media.class);
        if (media == null) {
            media =
(Media)service.getDefaultAttributeValue(Media.class);
            if (media == null) {
                media = MediaSizeName.NA_LETTER;
            }
        }

This would fall back to letter in case of a non default definition of a media size name and no such is defined within the request attributes...

If I compare the basic behavior in comparison to the Windows implementation. The are some differences in setting the default MediaSize and MediaSizeName. Those will be not initialized in the Windows world and taken from the current PrintService in case it's not set via PrintRequestAttributeSet.


I can see no way around this other than defining an new attribute class that doesn't subclass Media and duplicates MediaTray .. but then you'd also need to say what happens
if someone specifies two different trays, one by each means.

I do not completely understand what you mean. Do you mean the use case if one specifies A4,Tray2 but Tray2 contains Letter?

I meant that if we provided a new class "MediaSource" you could specify MediaSource.TRAY1 whilst still specifying for "Media" an instance of the subclass MediaTray that corresponded
to TRAY2. That's an API solution that doesn't seem likely any time soon.
I always thought that the MediaTray does specify the source already as it says in the JavaDoc:

"*IPP Compatibility:* MediaTray is a representation class for values of the IPP "media" attribute which name paper trays. "

In newer Printer there is also the possibility to specify the output tray as well but for this there is no specific definition within the spec.

Cheers

Patrick

Reply via email to