We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using insertHTML to insert custom IMG?


I have an HTML fragment with some img tags. The src is to a “protected” webpage that is not accessible from the web (and that’s why Aspose can’t pick it up, and instead we see a red cross in the Word doc).

I have the bytearray with the images content, my doubt is how can I do this transformation, replacing the my img src with the correct bytes to Aspose to work?

Is this not possible with Aspose? Do I have to regex my HTML and replace img tags with an insertImage (Aspose) instruction?



Thanks for your inquiry. I think, you can temporary save your images into a local folder and replace “inaccessible” urls of images with path to the stored images. For example if you have the following HTML and image is inaccessible, but you can can get image bytes of this image.

You can save your image in the temporary folder, let it be “C:\Temp” and replace image url with local path as shown below:

Hope this helps.
Best regards.

Does Aspose recognize the data URI scheme? ( http://en.wikipedia.org/wiki/Data_URI_scheme )

Something like:

<img src = "data:image/png;base64,
vr4MkhoXe0rZigAAAABJRU5ErkJggg==" alt="Red dot" />

This would be a cool way to do it


Thanks for your inquiry. Unfortunately, currently Aspose.Words does not support base64 data in HTML. Your request has been linked to the appropriate issue. We will consider supporting this feature in one of future versions.
So the only way to work the problem around, I can suggest you at the moment, is saving your images into temporary folder.
Best regards.

The issues you have found earlier (filed as 9180) have been fixed in this update.