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

Free Support Forum - aspose.com

Aspose.Word InsetImage issues

Hi.
I am using Apose.Word 20.5 and cant update to a later version right now. The version should not be a problem.

I have a word document with a bookmark, move to the bookmark and try to insert a byte[] type image.

I have in th same code part done a toBase64string coverting just to see that the image it self is for sure valid and not corrupted, thats why there is a convert in the middle, its ust for debugg reasons.

Code snippet is below
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark(“MapImage”);
string basestring = Convert.ToBase64String(control.GeoImage.GeoImage1);
builder.InsertImage(control.GeoImage.GeoImage1);

When it goes to InsertImage i get a error
System.Text.DecoderFallbackException: ‘Unable to translate bytes [89] at index 0 from specified code page to Unicode.’

image.png (3.3 KB)

The byte it reacts to is the first one, so 137.

This should not be a issue seeing as
The first eight bytes of a PNG file always contain the following (decimal) values:
137 80 78 71 13 10 26 10

The license i use is valid for my version so there should be no such issues.

I also tryed running the exact same code that currently is working on my server with the Servers database. This is all working on that server, but localy it aint and on every new release it dont on my other servers

I have solved the issue. It ended up beeing a issue not even related to Aspose.Word but it first showed like it. I am sorry, wish you all the best.

@Zwoll,

It is great that you were able to resolve the problem on your end. In case you have further inquiries or may need any help in future, please let us know by posting a new thread in Aspose.Words’ forum.