File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Printing in landscape mode. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Printing in landscape mode." Watch "Printing in landscape mode." New topic

Printing in landscape mode.

Rob Ross

Joined: Jan 07, 2002
Posts: 2205
Is there something special I have to know/do to get my paper to print in Landscape mode?
I'm putting up a printer dialog with

In the dialog, I'm clicking on the Properties...button, then selecting the Landscape radio button.
In my print() method, I'm using PageFormat.getImageableHeight() and PageFormat.getImageableWidth() to base my drawing calculation on.
But the width and height never seem to change whether I have selected Portrait or Landscape.
So how do I tell the PrintFormat to switch to landscape mode? And why does my choice in the Print dialog get ignored?
[ March 21, 2002: Message edited by: Rob Ross ]

SCJP 1.4
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
The PageFormat class describes the size and orientation of a page to be printed.
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
The issue is that when you click on the Properties... button, it doesn't make any changes to the PrinterJob's PrintFormat object.
I don't know if this is a bug or an oversight.
I agree. Here's the link:
subject: Printing in landscape mode.
It's not a secret anymore!