• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing more than one page

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,y);
g2.setClip(0,0,hPage,wPage);
}
else
{
g2.translate(x, -(pi*hPage));
g2.setClip(0,pi*hPage,hPage,wPage);
}
if (pi >= totalPages)
return NO_SUCH_PAGE;
else
{
contentViewer.paint(g2,contentViewer);
return Printable.PAGE_EXISTS;
}
}
Thanks,
- Raja.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic