This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Printing more than one page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Printing more than one page" Watch "Printing more than one page" New topic

Printing more than one page

Raja Kannappan
Ranch Hand

Joined: May 08, 2002
Posts: 83
I'm trying to print the contents of contentViewer (JHelpContentViewer).
Only the first page gets printed and the remaining pages are printed blank.
Can anyone please tell me why the remaining pages are printed blank?
This is how my print() method looks.
public int
print(Graphics g, PageFormat pf, int pi) throws PrinterException
int x = (int)pf.getImageableX();
int y = (int)pf.getImageableY();
int hPage = (int)pf.getImageableHeight();
int wPage = (int)pf.getImageableWidth();
Graphics2D g2 = (Graphics2D) g;
if (pi == 0)
g2.translate(x, -(pi*hPage));
if (pi >= totalPages)
return NO_SUCH_PAGE;
return Printable.PAGE_EXISTS;
- Raja.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Printing more than one page
It's not a secret anymore!