number of pages to print in JEditorPane
Greetings,
I'm trying to print the (html) contents of a JEditorPane with the following.
publicint print(Graphics g, PageFormat pf,int pi)throws PrinterException{
if (pi >= 2){
return Printable.NO_SUCH_PAGE;
}
// shift the graphics to the selected page
g.translate( (int)pf.getImageableX(),
(int)(pf.getImageableY() - pf.getImageableHeight()*pi) );
myJEditorPane.paint(g);
return Printable.PAGE_EXISTS;
}
This works fine for the first two pages. The problem is that I don't know how to determine the actual number of pages. How can I tell how many pages there are to print?
Thanks,
Keith

