Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: How to print in landscape?
|
Posted: Apr 5, 2002 7:33 PM
|
|
You need to specify the PageFormat as landscape. I don't know how you get the page format from the printDialog, but you can get it from the pageDialog() call. So where you call setPrintable(), you just need to specify a PageFormat, for example:
printJob.setPrintable(this, printJob.pageDialog( new PageFormat() ));
or
printJob.setPrintable(this, printJob.pageDialog( printJob.defaultPage() ));
Popping up two dialogs is kind of annoying, so it would be better to somehow glean the information from the printDialog(). Or is it just an idiosyncracy of the Windows platform that you can also change the page layout in the printer setup dialog? If you set the layout in the pageDialog and then changed it in the printDialog, the second change would probably be ignored in the example above. I haven't fooled much with printing, so I don't know how that is done, offhand. So rather than read my ramblings, you might want to look at this printing tutorial: http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html
|
|