// shift Graphic to line up with beginning of print-imageable region
g2.translate(pf.getImageableX(), pf.getImageableY());
// shift Graphic to line up with beginning of next page to print
g2.translate(0f, -pageIndex * pageHeight);
// scale the page so the width fits...
g2.scale(scale, scale);
// for faster printing, turn off double buffering
disableDoubleBuffering(componentToBePrinted);
componentToBePrinted.paint(g2); //repaint the page for printing
enableDoubleBuffering(componentToBePrinted);
response = Printable.PAGE_EXISTS;