} catch (IOException ex) {
Logger.getLogger(ImageOutput.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
boolean paint(Graphics g, int height, int pageIndex) {
Graphics2D g2d = (Graphics2D) g;
double panelHeight = d.height;
double pageHeight = height;
int totalNumPages = (int) Math.ceil(panelHeight / pageHeight);
g2d.translate(0f, -(pageIndex - 1) * pageHeight);
panel.paint(g2d);