"LANDSCAPE" should work in the next maintenance release - due in around
a month or so.
It looks like REVERSE_LANDSCAPE won't however, so you should plan to
use LANDSCAPE.
-phil.
> X-Authentication-Warning: capra.eng.sun.com: amith set sender to
[EMAIL PROTECTED] using -f
> Date: Tue, 27 Apr 1999 18:43:17 +0530
> From: "J.Ganesan" <[EMAIL PROTECTED]>
> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>,
[EMAIL PROTECTED]
> Subject: [java2d] LANDSCAPE does not work
>
> Hi,
> I have a problem in printing. setOreintation() on PageFormat appreantly
> does not have any effect. Our application does NOT require a pagedialog
> or printdialog. The prinout has to be in REVERSE_LANDSCAPE mode only. I
> explicitly call
>
> PrinterJob prnJob = PrinterJob.getPrinterJob() ;
> PageFormat pf = prnJob.defaultPage() ;
> pf.setOrientation( PageFormat.REVERSE_LANDSCAPE) ;
>
> The resultant output is like PORTRAIT orientation. I am giving below a
> sample code.
>
> Could someone please throw light on this problem.
>
> Thanks.
>
> ganesan
>
> ------------------------- sample code ----------------
> import javax.swing.* ;
> import java.awt.* ;
> import java.awt.print.* ;
>
> public class HorizontalLine implements Printable
>
> {
> public HorizontalLine()
> {
> super() ;
> }
>
> public void paint( Graphics g )
> {
> g.setColor(Color.black);
> g.drawLine( 100 , 100 , 300 , 100 ) ;
> }
>
> public int print(Graphics g, PageFormat pf, int pi) throws
> PrinterException
> {
> if (pi >= 1) {
> return Printable.NO_SUCH_PAGE;
> }
> paint(g);
> return Printable.PAGE_EXISTS;
> }
>
> public static void main( String[] args )
> {
> // Get a PrinterJob
> PrinterJob prnJob = PrinterJob.getPrinterJob();
> PageFormat pf = prnJob.defaultPage();
> // orientation has no effect
> pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
> prnJob.setPrintable(new HorizontalLine() , pf );
> try
> {
> prnJob.print();
> }
> catch (PrinterIOException e)
> { /* handle exception */
> System.out.println( e ) ;
> }
> catch (Exception e)
> { /* handle exception */
> System.out.println( e ) ;
> }
> }
> }
>
>
>
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/