[to skip the whole explination and just go right to the question, go to bottom of message] *
I hope I'm missing something fundamental from the Printing API because I'm just not getting this.
I want to create a Print Preview Dialog. I've done the drawingn part of this and it works quite well, it basically just takes the printable and "manually" calls the print method on it to preview the result of printing.
However, this is what the print() method looks in Printable ...
print(Graphics, PageFormat, int)
If the user first selects a "Page Setup" dialog, I "save" a copy of the returned page format. No big deal here (although I think this value should be saved in PrinterJob).
If the user doesn't select "Page Setup", I just use PrinterJob.defaultPage() which gives me a "default" PageFormat.
OK, no problems yet. But let's say the user selects print and now changes options, like page orientation and page type (letter,etc).
Fine the document prints, but now the values are not saved!
That is, when they hit print preview, the preview window should have the last orientation selected by the user.
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.
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".
Have a headache yet? ;-)
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 !!!!!!!!
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?
Can somebody help me? In short, unless I'm going in the total wrong direction, can somebody answer how to do this;
+---------------------------------------------------------------------
* How can I convert a PrintRequestAttributeSet into a PageFormat? (remember that page must have a size, not only Imagenable area).
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".
