ImagePlacement

遗产: java.lang.Object

public final class ImagePlacement

表示放置到 Pdf 文档页面的图像的特征。


The example demonstrates how to find images on the first PDF document page and get images as bitmaps with visible dimensions.
 
  
 //打开文档
 Document doc = new Document("D:\\Tests\\input.pdf");
 //创建 ImagePlacementAbsorber 对象以执行图像放置搜索
 ImagePlacementAbsorber abs = new ImagePlacementAbsorber();
 //接受第一页的吸收器
 doc.getPages().get_Item(1).accept(abs);
 //检索具有可见尺寸的图像
 for (ImagePlacement imagePlacement : ```
(Iterable)
```abs.getImagePlacements())
 {
     BufferedImage scaledImage;
     ByteArrayOutputStream imageStream = new ByteArrayOutputStream())
     
         //从资源中检索图像
         imagePlacement.getImage().save(imageStream, ImageFormatInternal.Png);
         BufferedImage resourceImage = (BufferedImage) ImageIO.read(imageStream);
         //创建具有实际尺寸的新位图
         scaledImage = new BufferedImage(resourceImage, (int)imagePlacement.getRectangle().getWidth(), (int)imagePlacement.getRectangle().getHeight());
     
 }

将图像放置到页面时,它可能具有资源中定义的物理尺寸以外的尺寸。 ImagePlacement 对象旨在提供尺寸、分辨率等信息。

方法

方法描述
equals(Object arg0)
getClass()
getCompositingParameters()为放置到页面的图像获取活动图形状态的合成参数。
getImage()获取相关的 XImage 资源对象。
getMatrix()此图像的当前变换矩阵。
getOperator()用于显示图像的运算符。
getPage()获取包含图像的页面。
getRectangle()获取图像的矩形。
getResolution()获取图像的分辨率。
getRotation()获取图像的旋转角度。
hashCode()
hide()从页面中删除图像。
notify()
notifyAll()
replace(InputStream image)用另一个图像替换集合中的图像。
save(OutputStream outputStream)保存具有相应变换的图像:缩放、旋转和分辨率。
save(OutputStream outputStream, ImageType format)保存具有相应变换的图像:缩放、旋转和分辨率。
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

equals(Object arg0)

public boolean equals(Object arg0)

参数:

范围类型描述
arg0java.lang.Object

退货: 布尔值

getClass()

public final native Class<?> getClass()

退货: java.lang.Class

getCompositingParameters()

public CompositingParameters getCompositingParameters()

为放置到页面的图像获取活动图形状态的合成参数。

退货: CompositingParameters - CompositingParameters 对象

getImage()

public XImage getImage()

获取相关的 XImage 资源对象。

退货: XImage-XImage 对象

getMatrix()

public Matrix getMatrix()

此图像的当前变换矩阵。

退货: Matrix 矩阵对象

getOperator()

public final Operator getOperator()

用于显示图像的运算符。

退货: Operator 运营商实例

getPage()

public Page getPage()

获取包含图像的页面。

退货: Page 页面对象

getRectangle()

public Rectangle getRectangle()

获取图像的矩形。

退货: Rectangle - 矩形对象

getResolution()

public Resolution getResolution()

获取图像的分辨率。

退货: Resolution 解析对象

getRotation()

public float getRotation()

获取图像的旋转角度。

退货: 浮点数 - 整数值

hashCode()

public native int hashCode()

退货: 整数

hide()

public final void hide()

从页面中删除图像。

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

replace(InputStream image)

public void replace(InputStream image)

用另一个图像替换集合中的图像。

参数:

范围类型描述
imagejava.io.InputStream包含图像数据的流。

save(OutputStream outputStream)

public void save(OutputStream outputStream)

保存具有相应变换的图像:缩放、旋转和分辨率。

参数:

范围类型描述
outputStreamjava.io.OutputStream将保存图像的流

save(OutputStream outputStream, ImageType format)

public void save(OutputStream outputStream, ImageType format)

保存具有相应变换的图像:缩放、旋转和分辨率。

参数:

范围类型描述
outputStreamjava.io.OutputStream将保存图像的流
formatImageType将用于图像编码的格式。图像格式

toString()

public String toString()

退货: java.lang.字符串

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

参数:

范围类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

参数:

范围类型描述
arg0long
arg1int