Using insertHTML to insert custom IMG?

Hi,

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

Hi

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,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
vr4MkhoXe0rZigAAAABJRU5ErkJggg==" alt="Red dot" />

This would be a cool way to do it

Hi

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.