请参考以下代码:
long position = page.getLastGraphicsObjectPosition(e_TypeImage);
Image image = new Image(image_file);
ImageObject image_object = ImageObject.create(page.getDocument());
image_object.setImage(image, 0);
float width = image.getWidth();
float height = image.getHeight();
float page_width = page.getWidth();
float page_height = page.getHeight();
//请注意矩阵值。
image_object.setMatrix(new Matrix2D(width, 0, 0, height, (page_width – width) / 2.0f, (page_height – height) /
2.0f));
page.insertGraphicsObject(position, image_object);
page.generateContent();