By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,554 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,554 IT Pros & Developers. It's quick & easy.

Java Print Landscape

P: n/a
Trying & trying ad infinitum to print page in landscape mode from Java
program - orientation is correct landscape but printing width will NOT
go to landscape - always prints in portrait mode width - how to get
width out to landscape??????

Graphics2D g2d = (Graphics2D)g;
//Paper paper = new Paper();
Paper paper = pageFormat.getPaper();

//default portrait width=468 hi=648 x=72 y=72
pwidth = paper.getImageableWidth();
phi = paper.getImageableHeight();

// reverse width & height for landscape
paper.setSize(phi, pwidth);
paper.setImageableArea(10, 10, phi, pwidth);
pageFormat.setOrientation(PageFormat.LANDSCAPE);
pageFormat.setPaper(paper);
g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
etc. print still portrait width!!!!!!
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.