* @param arguments List
* @throws IOException If there is an error invoking the sub object.
*/
public void process(PDFOperator operator, List arguments) throws IOException
{
PageDrawer drawer = (PageDrawer)context;
PDPage page = drawer.getPage();
Dimension pageSize = drawer.getPageSize();
Graphics2D graphics = drawer.getGraphics();
COSName objectName = (COSName)arguments.get( 0 );
Map xobjects = drawer.getResources().getXObjects();
PDXObject xobject = (PDXObject)xobjects.get( objectName.getName() );
if( xobject instanceof PDXObjectImage )
{
PDXObjectImage image = (PDXObjectImage)xobject;
try
{
image.setGraphicsState(drawer.getGraphicsState());
BufferedImage awtImage = image.getRGBImage();
if (awtImage == null)
{
log.warn("getRGBImage returned NULL");
return;//TODO PKOCH
}
int imageWidth = awtImage.getWidth();
int imageHeight = awtImage.getHeight();
double pageHeight = pageSize.getHeight();
log.info("imageWidth: " + imageWidth + "\t\timageHeight: " + imageHeight);
Matrix ctm = drawer.getGraphicsState().getCurrentTransformationMatrix();
int pageRotation = page.findRotation();
AffineTransform ctmAT = ctm.createAffineTransform();
ctmAT.scale(1f/imageWidth, 1f/imageHeight);
Matrix rotationMatrix = new Matrix();