Red X in place of image

Hi support,

We’re having an issue with using the InsertHTML function in Aspose.Words.

It seems to happen for large images. We’re using an image size of 16Mb in order to see it happen consistently, but it happens for smaller images intermittently.

I’ve attached the Word and PDF outputs. Here is the code we are using:

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Aspose.Words;
	
namespace UnitTest {
	
	[TestClass]
	public class UnitTest2 {
	
		[TestMethod]
		public void TestAsposeWordImageInsertion() {
	
		    Document testdoc = new Document();
		    DocumentBuilder builder = new DocumentBuilder(testdoc);
	        string html = "<p><img src=\"http://lvmgt.com/wp-content/uploads/2016/07/Test-41.jpg\" alt=\"\" width=\"800\" height=\"800\" /></p>";
		    builder.InsertHtml(html);
		    testdoc.Save("C:\\test\\Test.pdf", SaveFormat.Pdf);
		}
	}
}

Thanks.

Hi Andrew,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15338. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks, do you have a timescale for a fix to be released? Am I able to track the issue somewhere?


Regards,
Andrew.
Hi Andrew,

Thanks for your inquiry. We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. Our developers work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, your issue is pending for analysis and is in the queue. Once our product team completes the analysis of your issue, we will then be able to provide you an estimate.

Thanks for your patience and understanding.

Hi,


I was wondering if you could update me on the progress of this issue.

We’re struggling for viable workarounds for our application.

Kind regards,
Andrew.
Hi Andrew,

Thanks for your inquiry. We have asked for the ETA of this issue from our product team. As soon as any information is shared by them, we will be more than happy to share that with you.

Thanks for your patience and understanding.

@kasperlfc,

The issues you have found earlier (filed as WORDSNET-15338) have been fixed in this Aspose.Words for .NET 17.8 update and this Aspose.Words for Java 17.8 update.

Hi,

I’ve tried it out in the latest version (17.9) and the image appears to work when saving as Word, but the PDF version has not worked. There is no red X any longer, but the image is just not there.

I used my same test code as the original post with a nice image from NASA: https://goes.gsfc.nasa.gov/pub/goes/080913.ike.poster.jpg

Andrew.

@kasperlfc,

Thanks for your inquiry. We are investigating this issue and will get back to you soon.

@kasperlfc,

We have tested the scenario using latest version of Aspose.Words for .NET 17.9 and have not found the shared issue. We have attached the output PDF with this post for your kind reference. output.zip (2.2 MB)

Turns out that it is the red X I’m still seeing, it was just too big for me to see it in the PDF.

Please see code below and results here https://drive.google.com/file/d/0B3-jNp1HrI1kZ3J1SDVXbDNVbjQ/view?usp=sharing

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Aspose.Words;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]

        [TestMethod]
        public void TestAsposeWordPdfImageInsertion()
        {
            Document testdoc = new Document();
            DocumentBuilder builder = new DocumentBuilder(testdoc);
            string html = "<img src=\"https://goes.gsfc.nasa.gov/pub/goes/080913.ike.poster.jpg\" height=\"500\" width=\"500\" ></img>";
            builder.InsertHtml(html);
            testdoc.Save(@"C:\test\Test.pdf", SaveFormat.Pdf);
        }

        [TestMethod]
        public void TestAsposeWordImageInsertion()
        {
            Document testdoc = new Document();
            DocumentBuilder builder = new DocumentBuilder(testdoc);
            string html = "<img src=\"https://goes.gsfc.nasa.gov/pub/goes/080913.ike.poster.jpg\" height=\"500\" width=\"500\" ></img>";
            builder.InsertHtml(html);
            testdoc.Save(@"C:\test\Test.docx");
        }

    }
}

@kasperlfc,

Thanks for your inquiry. You are using Aspose.Words for .NET 17.8. We suggest you please upgrade to the latest version of Aspose.Words for .NET 17.9. We have not found the shared issue while using latest version of Aspose.Words for .NET 17.9. Please check the attached output PDF in my previous post.

I have exactly the same result in 17.9. (I added a width and height to the HTML as well so I could see it on one page)

https://drive.google.com/open?id=0B3-jNp1HrI1ka1M5WVlwdVB1OXM

Regards,
Andrew.

@kasperlfc,

Thanks for your inquiry. Please use the following configuration settings (HttpWebRequestElement.UseUnsafeHeaderParsing) in your application. Hope this helps you.

<configuration>
	<system.net>
		<settings>
			<httpWebRequest useUnsafeHeaderParsing ="true" />
		</settings>
	</system.net>
</configuration>
HttpWebRequestElement webRequestSettings = new HttpWebRequestElement();
webRequestSettings.UseUnsafeHeaderParsing = true;

Hi,

Thanks for your response. Simply moving it out of a unit test into a console application seemed to fix the issue. We’ll test it in our actual application, but fingers crossed this is now working!

Thanks,
Andrew.