Insert image into document from URL does not work using C#

how to insert remote image in word document using documentbuilder.inserthtml in aspose.words?

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.

documentbuilder.inserthtml not working for serverpath image url in Aspose.words?

if i have html image tag with src as server path url....iam not able to write tht image to pdf?

Hi,

Thanks for your query. It would be great if you please share your html along with source code for investigation purposes.

iam unable to paint the image in pdf...if the image src as server path image url in aspose.words?.....please see my below code and server path links....

Not working links

http://cdn.aspose.com/homepage/images/logo.png

if i have https or www in links in image tag src then it was working fine.....if i have serverpath in url then it is not working.....

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

string html = @"

<img src='<FONT color=#008000 size=2><FONT color=#008000 size=2>http://cdn.aspose.com/homepage/images/logo.png'

alt='test image' width='178' height='129' />

";

builder.InsertHtml(html);

doc.Save(@"c:\sample.pdf");

Hi,

I have used the same code and have not found the issue while using latest version of Aspose.Words for .NET. Please use the latest version of Aspose.Words for .NET. I have attached the output PDF with this post.

i tried by using aspose.words 11.4.0.0 version…to write image in pdf even though iam getting cross mark in pdf…actaully iam getting image from server…if i hit tht url iam geeting image in browser…same if i used to do by aspose.words iam getting cross mark in pdf…iam not getting whts the problem with code…pls help me out

Hi,


Thanks for your inquiry. Please note that Aspose.Words automatically downloads the image before inserting into the document if you specify a remote URL in src attribute. Could you please confirm if the images can be downloaded/displayed to web browsers by entering server URLs into browsers on your side?

Best Regards,

Yes, images are displayed to web browsers by entering server URLs into browsers......

but if iam trying same server url in src from code side using aspose.words iam getting cross mark in word document by documentbuilder.inserthtml......pls help me out......i tried by using latest version 11.4.0.0 aspose.words..mine is remote image thts y iam getting probs...how to insert remote image into word document in aspose.words using documentbuilder.inserthtml....

Hi,


Thanks for the additional information. Could you please double check if there is any Firewall that might be blocking Aspose.Words from downloading images from server? Also, could you please share your server URL, you’re getting this problem with, here for testing? I will investigate the issue further and provide you more information.

Best Regards,

tht server url is accessing only from here ......if any person login from outside system then tht url doesnt work....no issue with firewalls..let me know is there any other reasony y Aspose.words is not downloading images from server....iam facing thsi problem in test site and stage site...where as it was working fine in production......

i tried to test in local system and remote server machine(Dev Servers) same problem iam getting cross mark in word dcoument........

Hi,

Thanks for sharing the information. It would be great if you please share your working environment like Operating System, .NET framework etc. for investigation purposes.

Hi,

Thanks for your query. It would be great if you please share your working
environment like Operating System, .NET framework etc. for investigation
purposes. Please also share the URL of image file.

Operating system-microsoft windows xp professional ersion 2002 with servcie pack 3 and .net frame work 3.5 version in local system…Remote url of image file will be access from here not from other outside systems…if anyone login from other systems path will not work and no image will display…In remote machine Os-windows server 2003 enterprise edition with service pack 2…visual studio 2008 with .net frame work 3.5…

I shared my OS and .Net Framework details in detail......any update on this post..iam waiting for ur reply....

Hi,

Please accept my apologies for late response.

We have tested the scenario at different Operating Systems and have not found any issue with Aspose.Words for .NET. Please create a test application with following code and share your finding with us. It seems that the URL you are using in IMG tag has access restrictions at your side.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

string html = @"<img src='<font color="#008000" size="2"><font color="#008000" size="2">http://cdn.aspose.com/homepage/images/logo.png' alt='test image' width='178' height='129' />";

builder.InsertHtml(html);

doc.Save(@"c:\sample.pdf");

for the same url we can able to see the image but from aspose.words the image is not displaying in document how can we confirm whether firewall is blocking aspose.words?

Hi,

It would be great if you please check the firewall log and your system event viewer security log for this issue. Please check either specific URL is blocked or not.

Hi,

I had a similar issue and if I turn off McAfee Antivirus on my dev machine then the image appears ok - so I think it is a FireWall issue for the other person.

Hope that helps to clarify.

Dave

Hi David,

Thanks for sharing your experience on this issue. We always appreciate positive feedback from our customers. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Hi,


I am not able to display the image on aspose pdf document. Only text is being displayed and in place of image I am getting cross mark.
I used “builder.InsertHtml(html)” statement and in “html” I am getting the image tag + text from Sql Server data base table column in the form of string.
I am getting the below string in html.
"<img alt="" src="/EditorImages/Nuvola_apps_personal.png" />xyz"
But after executing “builder.InsertHtml(html)” statement, I am getting the text “xyz” and in place of image it is showing cross mark.
I am using aspose words 11.10.0 version.

Please help me out.

Thankyou