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

Free Support Forum - aspose.com

Error inserting PNG

Hi


We are using the Aspose.Words library within a .NET winforms application. We are having a problem inserting images when the image is a png. The version of the library is v10.8.0.0. I have searched for this error and believed it to have been resolved in this version of the library so apologies if I should be looking elsewhere.

The code we are using (and which works correctly) is:

Dim Builder As New DocumentBuilder(awDoc) Builder.MoveToBookmark(MyBookMark.Name)
Builder.InsertImage("C:\image.jpg")

However if we try and replace the image with "C:\image.png" and insert as follows we get an "Unable to read beyond the end of the stream" exception.

Any help would be much appreciated.

Ed

Hi Ed,


Thanks for your inquiry.

Could you please attach the problem PNG image here for testing? We will take a look into this for you and provide you with some feedback.

Thanks,

Hi,


Thanks for your inquiry. While inserting png image, i don’t observe any problem.
(i am using Aspose.Words 10.8)

//New document object
Document doc = new Document();

//New Document Builder object
DocumentBuilder builder = new DocumentBuilder(doc);

//Insert png type image
builder.InsertImage(“d:/test/image.png”);

//Save it
doc.Save(“d:/insertpngimage.docx”);

In case of any ambiguity, please feel free to share along with attachments.
I have attached the Word Document.