com.lowagie.text.rtf.graphic

Class RtfImage

public class RtfImage extends RtfElement

The RtfImage contains one image. Supported image types are jpeg, png, wmf, bmp.

Version: $Revision: 1.23 $

Author: Mark Hall (mhall@edu.uni-klu.ac.at) Paulo Soares

Field Summary
intalignment
The alignment of this picture
floatheight
The height of this picutre
byte[]image
The actual image.
intimageType
The type of image this is.
floatplainHeight
The intended display height of this picture
floatplainWidth
The intended display width of this picture
static byte[]PICTURE
Constant for a picture
static byte[]PICTURE_BMP
Constant for a bmp image
static byte[]PICTURE_GROUP
Constant for the shape/picture group
static byte[]PICTURE_HEIGHT
Constant for the picture height
static byte[]PICTURE_JPEG
Constant for a jpeg image
static byte[]PICTURE_PNG
Constant for a png image
static byte[]PICTURE_SCALED_HEIGHT
Constant for the picture height scale
static byte[]PICTURE_SCALED_WIDTH
Constant for the picture width scale
static byte[]PICTURE_WIDTH
Constant for the picture width
static byte[]PICTURE_WMF
Constant for a wmf image
booleantopLevelElement
Whether this RtfImage is a top level element and should be an extra paragraph.
floatwidth
The width of this picture
Constructor Summary
RtfImage(RtfDocument doc, Image image)
Constructs a RtfImage for an Image.
Method Summary
byte[]getImage(Image image)
Extracts the image data from the Image.
voidsetAlignment(int alignment)
Sets the alignment of this RtfImage.
voidsetTopLevelElement(boolean topLevelElement)
Set whether this RtfImage should behave like a top level element and enclose itself in a paragraph.
byte[]write()
Writes the RtfImage content

Field Detail

alignment

private int alignment
The alignment of this picture

height

private float height
The height of this picutre

image

private byte[] image
The actual image. Already formated for direct inclusion in the rtf document

imageType

private int imageType
The type of image this is.

plainHeight

private float plainHeight
The intended display height of this picture

plainWidth

private float plainWidth
The intended display width of this picture

PICTURE

private static final byte[] PICTURE
Constant for a picture

PICTURE_BMP

private static final byte[] PICTURE_BMP
Constant for a bmp image

PICTURE_GROUP

private static final byte[] PICTURE_GROUP
Constant for the shape/picture group

PICTURE_HEIGHT

private static final byte[] PICTURE_HEIGHT
Constant for the picture height

PICTURE_JPEG

private static final byte[] PICTURE_JPEG
Constant for a jpeg image

PICTURE_PNG

private static final byte[] PICTURE_PNG
Constant for a png image

PICTURE_SCALED_HEIGHT

private static final byte[] PICTURE_SCALED_HEIGHT
Constant for the picture height scale

PICTURE_SCALED_WIDTH

private static final byte[] PICTURE_SCALED_WIDTH
Constant for the picture width scale

PICTURE_WIDTH

private static final byte[] PICTURE_WIDTH
Constant for the picture width

PICTURE_WMF

private static final byte[] PICTURE_WMF
Constant for a wmf image

topLevelElement

private boolean topLevelElement
Whether this RtfImage is a top level element and should be an extra paragraph.

width

private float width
The width of this picture

Constructor Detail

RtfImage

public RtfImage(RtfDocument doc, Image image)
Constructs a RtfImage for an Image.

Parameters: doc The RtfDocument this RtfImage belongs to image The Image that this RtfImage wraps

Throws: DocumentException If an error occured accessing the image content

Method Detail

getImage

private byte[] getImage(Image image)
Extracts the image data from the Image. The data is formated for direct inclusion in a rtf document

Parameters: image The Image for which to extract the content

Returns: The image data formated for the rtf document

Throws: DocumentException If an error occurs accessing the image content

setAlignment

public void setAlignment(int alignment)
Sets the alignment of this RtfImage. Uses the alignments from com.lowagie.text.Element.

Parameters: alignment The alignment to use.

setTopLevelElement

public void setTopLevelElement(boolean topLevelElement)
Set whether this RtfImage should behave like a top level element and enclose itself in a paragraph.

Parameters: topLevelElement Whether to behave like a top level element.

write

public byte[] write()
Writes the RtfImage content

Returns: the RtfImage content