We are generating word (and pdf) document with Aspose.Words 9.3.0 from a SharePoint intranet site, and we encounter problems when images are located on a SharePoint Library.
Our field value is something like :
Html text […]
<img src="http://www.google.fr/images/chrome_48.gif" /> : works !
<img src="http://current-sharepoint-site/SiteImages/logo.gif" /> : doesn’t work !
Html text […]
There is no problem with InsertImage() method, it can insert images that are located on the SharePoint library, but when image is included on a html field, it doesn’t render if it’s a local sharepoint image.
Many thanks for your help.
Thanks for your inquiry. The problem might occur because Aspose.Words cannot load the image. For example, this might occur if you do not have permissions to open the image. Please make sure that the image is accessible.
I think that you’re right because the image is not included (in fact it is but with a red cross) into docx(cab) container, whereas the others are well included.
I tried using SPSecurity.RunWithElevatedPrivileges to execute the builder.InsertHtml and the document.Save and the problem is still here.
How can I give Aspose.Words library enough rights to load the image ? Which account is used to perform this action ?
Thanks for your inquiry. Aspose.Words uses the same account as is used to run the application, which uses Aspose.Words. If you are able to insert the image using DocumentBuilder.InsertImage method from the specified url, you should also be able to insert the same image using DocumentBuilder.InsertHtml method.
Could you please provide me more information how I can reproduce the problem on my side? I will check the issue and provide you more information.