BufferedImage retval = new BufferedImage( widthPx, heightPx, imageType );
Graphics2D graphics = (Graphics2D)retval.getGraphics();
graphics.setBackground( Color.WHITE );
graphics.clearRect( 0, 0, retval.getWidth(), retval.getHeight() );
graphics.scale( scaling, scaling );
PageDrawer drawer = new PageDrawer();
drawer.drawPage( graphics, this, pageDimension );
//TODO This could be done directly by manipulating the transformation matrix before painting.
//That could result in a better image quality.
try
{