When inserting images with DocumentBuilder.InsertHtml(), the following behaviour occurs:
1.) The following fails (the image is displayed as a red “X”):
<p>
<img src='file:///c:/somefolder/someimage.JPG' />
</p>
2.) The following also fails (the image is displayed as a red “X”):
<p>
<img src='\\myserver\c$\somefolder\someimage.JPG' />
</p>
3.) The following also fails (the image is displayed as a red “X”):
<p>
<img src='file://myserver/c$/somefolder/someimage.JPG' />
</p>
4.) only the following succeeds:
<p><img src='c:\somefolder\someimage.JPG' /></p>
All 4 should be valid, but only the fourth actually is.
Since I can work-around 1 (by specifying 4 instead), scenario 2 (or 3) is not workaroundable.
Do you have any hints and/or fixes to this?
Thanks
Uwe
Hi,
It seems like you are correct and such URIs are not supported. Aspose.Words uses the common .NET approach for loading images such as File.Open for local images and WebRequest/WebResponse classes for remote images so basically it should support all URIs supported by this approach. However, I have logged your request as #1527 and we will try to look into it ASAP.
Great to hear! Thank you for your feedback!
Cheers
Uwe
One more addition:
If you say “…uses the common .NET approach for loading images…”, then my example 2.)
<p><img src='\\myserver\c$\somefolder\someimage.JPG' /></p>
Should be totally legal and parsable, shouldn’t it?
Yes, in this case it is passed to File.Open. AFAIK it should be able to open files from the network. Try to load your image using File.Open and if it fails, then in this case it is not a failure of Aspose.Words.
Unfortunately, File.Open succeeds.
Any progress update, Dmitry?
Thanks
Uwe
Yes, we are working on the new hotfix right now. We wanted to release it today but decided to include more fixes into it so I presume it is a couple of days away. I believe this URLs issue will be addressed as well.
Good news! Thanks so far :-). Hopefully the URL fix is included.
Cheers
Uwe
Fixed in Aspose.Words 4.2.1.
The URL for download is
https://downloads.aspose.com/words/net
Best regards,
Yes, it does work now.
Great work, great support. Thank you!