public int print(Graphics pg, PageFormat pageFormat, int pageIndex)
{
if (m_img != null && pageIndex == 0)
{
pg.translate((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY());
RepaintManager currentManager = RepaintManager.currentManager(this);
currentManager.setDoubleBufferingEnabled(false);
Graphics2D g2d = (Graphics2D)pg;
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
doPaint(pg, new Dimension((int)pageFormat.getImageableWidth(), (int)pageFormat.getImageableHeight()), true);
currentManager.setDoubleBufferingEnabled(true);
System.gc();
return PAGE_EXISTS;
}
return NO_SUCH_PAGE;
}