/** * Constructs a RtfImage for an Image. * * @param doc The RtfDocument this RtfImage belongs to * @param image The Image that this RtfImage wraps * @throws DocumentException If an error occurred accessing the image content */ public RtfImage(RtfDocument doc, Image image) throws DocumentException { super(doc); imageType = image.getOriginalType(); if (!(imageType == Image.ORIGINAL_JPEG || imageType == Image.ORIGINAL_BMP || imageType == Image.ORIGINAL_PNG || imageType == Image.ORIGINAL_WMF || imageType == Image.ORIGINAL_GIF)) { throw new DocumentException("Only BMP, PNG, WMF, GIF and JPEG images are supported by the RTF Writer"); } alignment = image.getAlignment(); width = image.getWidth(); height = image.getHeight(); plainWidth = image.getPlainWidth(); plainHeight = image.getPlainHeight(); this.imageData = getImageData(image); }
/** * Constructs a RtfImage for an Image. * * @param doc The RtfDocument this RtfImage belongs to * @param image The Image that this RtfImage wraps * @throws DocumentException If an error occurred accessing the image content */ public RtfImage(RtfDocument doc, Image image) throws DocumentException { super(doc); imageType = image.getOriginalType(); if (!(imageType == Image.ORIGINAL_JPEG || imageType == Image.ORIGINAL_BMP || imageType == Image.ORIGINAL_PNG || imageType == Image.ORIGINAL_WMF || imageType == Image.ORIGINAL_GIF)) { throw new DocumentException(MessageLocalization.getComposedMessage("only.bmp.png.wmf.gif.and.jpeg.images.are.supported.by.the.rtf.writer")); } alignment = image.getAlignment(); width = image.getWidth(); height = image.getHeight(); plainWidth = image.getPlainWidth(); plainHeight = image.getPlainHeight(); this.imageData = getImageData(image); }
public static byte[] wrapBMP(Image image) throws IOException { if (image.getOriginalType() != Image.ORIGINAL_BMP) throw new IOException(MessageLocalization.getComposedMessage("only.bmp.can.be.wrapped.in.wmf")); InputStream imgIn;
public static byte[] wrapBMP(Image image) throws IOException { if (image.getOriginalType() != Image.ORIGINAL_BMP) throw new IOException("Only BMP can be wrapped in WMF."); InputStream imgIn;
public static byte[] wrapBMP(Image image) throws IOException { if (image.getOriginalType() != Image.ORIGINAL_BMP) throw new IOException(MessageLocalization.getComposedMessage("only.bmp.can.be.wrapped.in.wmf")); InputStream imgIn;