{
PDXObjectImage image = (PDXObjectImage)xobject;
try
{
BufferedImage awtImage = image.getRGBImage();
Matrix ctm = drawer.getGraphicsState().getCurrentTransformationMatrix();
int width = awtImage.getWidth();
int height = awtImage.getHeight();
double rotationInRadians =(page.findRotation() * Math.PI)/180;
AffineTransform rotation = new AffineTransform();
rotation.setToRotation( rotationInRadians );
AffineTransform rotationInverse = rotation.createInverse();
Matrix rotationInverseMatrix = new Matrix();
rotationInverseMatrix.setFromAffineTransform( rotationInverse );
Matrix rotationMatrix = new Matrix();
rotationMatrix.setFromAffineTransform( rotation );
Matrix unrotatedCTM = ctm.multiply( rotationInverseMatrix );
Matrix scalingParams = unrotatedCTM.extractScaling();
Matrix scalingMatrix = Matrix.getScaleInstance(1f/width,1f/height);
scalingParams = scalingParams.multiply( scalingMatrix );
Matrix translationParams = unrotatedCTM.extractTranslating();
Matrix translationMatrix = null;
int pageRotation = page.findRotation();
if( pageRotation == 0 )
{
translationParams.setValue(2,1, -translationParams.getValue( 2,1 ));
translationMatrix = Matrix.getTranslatingInstance(