Free Support Forum - aspose.com

Aspose.Words - "Unable to read beyond the end of the stream."

I have the following code :

For index = 0 To alHTML.Count - 1
Dim chart As ChartObject = New ChartObject()

chart = CType(alHTML(index), ChartObject)

If chart.type = "HTML" Then
builder.InsertHtml(chart.html)
End If
If chart.type = "Chart" Then
builder.InsertImage(chart.html)
builder.Writeln()
End If
Next
builder.Document.Save("c:\temp\" + "Out.doc")

I get the error when I try to insertImage.

The image is an URL to the image.

Thanks

Bill

There might be a problem with dowloading the image or with the image itself. If the URL is publicly accessible on the web, let me know, I will try to reproduce downloading. If not, just attach the image file here, I will try with it.

That URL's of the Image that in this ArrayList are :

http://www.zipsurvey.com/BuildGraph.aspx?rcid=6176
http://www.zipsurvey.com/BuildGraph.aspx?rcid=6179
http://www.zipsurvey.com/BuildGraph.aspx?rcid=6196
http://www.zipsurvey.com/BuildGraph.aspx?rcid=6197
http://www.zipsurvey.com/BuildGraph.aspx?rcid=6199

Thanks

Bill

Thanks. I've reproduced this. The problem seems to be related to extra garbage 4 bytes at the end of the PNG file. I've fixed Aspose.Words to handle such image successfully anyway. When a new release is made in the next few days, you will be notified.

Thanks for the quick response.

Bill

We have released a new version of Aspose.Words that contains a fix for your issue.


issue #4239 - Cannot insert PNG image, error Unable to read beyond the end of the stream.

The new version of Aspose.Words is available for download from here.

Best regards.

Thank you very much. It seems to be working great now.

-Bill

ReliantLive.com