I am using documentBuilder.insertHTML to insert an HTML string into a document. The HTML string includes an <IMG tag.
When the URL for the image is "localhost," the image displays correctly in the document. When the url is a remote host, the image does not display. It is replaced with a small box containing an x.
How do I get a remote image to display correctly? The image displays fine in IE or Outlook, just not a document created from Aspose.
Dmitry and / or romank, this leads to a follow-up question. The problem was with proxy authentication. Is there anything in the Aspose suite which would enable us to authenticate to a proxy before opening the Word document with the URL?
So is it a proxy or the remote server seeking authentication?
I guess it is not hard to allow credentials both for remote server and proxy to be specified, thanks the .NET WebRequest class has Credentials and Proxy properties. It is just a question of finding an appropriate place for them in the Aspose.Words API. It is also interesting this is only the first time this feature is being requested.
Do you have any ideas how you want to be able to pass the credentials in?
Credentials might be needed in the following places in Aspose.Words:
DocumentBuilder.InsertImage(string). If you pass a URL, it might be to a server requring authentication and therefore it might be useful to pass the credentials too.
DocumentBuilder.InserHTML. Same as above.
Document - load HTML. Same as above.
ImageData.SetImage(string). Same as above.
Insert an image during mail merge. Same as above.
ImageData.ToStream(). If the image is linked and not stored in the document, it is retrieved and saved to a memory stream and then returned. Retrieving the image might require authentication.
Export to HTML or PDF. Same as above (if the image is linked and not stored in the document, it is retrieved and saved).
I could add Document.Credentials property, but also need Document.Proxy? to allow for HTTP proxy authentication. But that does not help when one needs to load a complete document from HTML using Document ctor. Create more overloads for the ctor?