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 Scale a page using Graphics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Scale a page using Graphics" Watch "Scale a page using Graphics" New topic

Scale a page using Graphics

Manjula Rao

Joined: Dec 13, 2000
Posts: 21
how do i scale a page before printing using Graphics and not Graphics2D?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Scale a Page? Do you mean limit the amount that will be printed?

"JavaRanch, where the deer and the Certified play" - David O'Meara
Manjula Rao

Joined: Dec 13, 2000
Posts: 21
No i do not mean limiting the area printed but to reduce the size of the fonts proportionately so that the whole web page is acomodated in one page. ofcourse by that i mean width wise well accomodated and not page wise. if the matter spans over multi pages then it will continue doing so.
this i am able to do thru Graphics2D using
Graphics2D g2d = (Graphics2D)g; //where g is a Graphics object.
this scales the page to 50% of the actual size proportionately.
Now the problem that i am having is that using Graphisc2D object scaling is possible but multi page printing is not getting possible. but if i use a Graphics object then multipage printing is perfect but the matter printed is huge and sometimes gets cut from the margines.
if any suggestions regarding these problems, they r welcome.
Jahanzeb Sayal

Joined: Mar 02, 2001
Posts: 21
MultiPage printing is possible using Graphics2D ...
Read the printing article on & also read chapter 6 of the following online book i belive it will work becoz i have just done it... if any problems ... tell me i will post the code... u can email me...

I agree. Here's the link:
subject: Scale a page using Graphics
It's not a secret anymore!