Free Support Forum - aspose.com

Inserting image with Words Java v2.0

Is there any other way to insert an image other than docBuilder.insertImage? I would like to add an image as a byte[] or java.awt.Image beacuse the image does not reside on disk. Thanks in advance.

In the next release will be added DocumentBuilder.insertImage() overloads with java.io.InputStream and java.awt.Image as image sources. That release scheduled within two weeks.

If you strongly needed in another image sources like a byte array or java.nio.ByteBuffer, we can consider that additional image sources for DocumentBuilder.

Best Regards,

We can just convert a byte array to a java.awt.Image and pass it to the insertImage. Thanks for the quick reply (as usual) and we’ll be waiting for the next release.

Besides using DocumentBuilder.InsertImage it is possible to create an image as a Shape node directly. Then use Shape.Image.SetImage methods, but they essentially will accept same sources as DocumentBuilder.InsertImage.

http://www.aspose.com/Products/Aspose.Words/Api/Aspose.Words.Drawing.Shape.html