>One solution is to use PrintRequestAttributeSet. Create an instance and
>pass it around for the page setup and print dialogs. These dialogs set
>the values of the passed PrintRequestAttributeSet whenever the user uses
>these dialogs.


This was the idea. The limitations of the old APIs were intended to
be fixed in the new API.

>
>That's fine, I've done that. But when I do a print preview I have no way
>of converting my "saved" PrintRequestAttributeSet to a PageFormat object
>!!! Which I need in the first place so that I can do the "Print Preview".
>

This is possible, JDK already does this internally. We are working with
the same information you have. So you want a convenience method like:

4500750: RFE: convenience API to calculate PageFormat from
PrintRequestAttributeSet


>
>I tried to convert PrintRequestAttributeSet, but I fail to do so
>reliably. I can figure out the orientation, (although OrientationRequest
>has ONE more value than pageFormat, what?!?!?), whoever how do I create
>a Page?

>
>I can get MediaPrintableArea and make a new Page from these values, but
>THERE'S NO WAY TO GET the size of the paper from this object, nor
>MediaSizeName !!!!!!!!

That's wrong. You are missing the API that was designed to do this for you.

Its in a class called javax.print.attribute.standard.MediaSize.
The MediaSize class is basically nothing more than a big enumeration of
paper sizes and mappings to/from MediaSizeName

YOu can get the size you need from there.

Look at MediaSize MediaSize.getMediaSizeForName(MediaSizeName media);

Once you have your MediaSize object you just pull out the w & h
and create your PageFormat.


>
>In order to do a print preview, I need to know the size of the paper.
>And these values can not be extracted from the PrintRequestAttributeSet
>at all. Why is PRintRequestAttributeSet seems like it's mismatched to
>PageFormat?
>

I don't think it is mismatched, at least it matches as well as we could
make it. Integration of java.awt.print and javax.print was a design goal
so the former could leverage the latter as much as possible.

-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".

Reply via email to