Load HTML from URL with external images and CSS

Hello,

I try to load an html file from an url in order to convert it to a pdf file.
I obtain the following mistake : buffer cannot be null. Is there a way to solve this ?
Here is the code that I use :
class Program
    {
        static void Main(string[] args)
        {
            ImageLoadingWithCredentialsHandler imageLoadingWithCredentialsHandler = new ImageLoadingWithCredentialsHandler();
            Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
            loadOptions.ResourceLoadingCallback = imageLoadingWithCredentialsHandler;
	    Aspose.Words.Document elise = new Aspose.Words.Document("http://localhost:81/Elise.html", loadOptions);
            elise.Save(@"C:\temp\test\output\Elise.pdf");
        }
    }
<span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">ImageLoadingWithCredentialsHandler</span> : <span style="color:#2b91af;">IResourceLoadingCallback</span>
{
    <span style="color:blue;">public</span> ImageLoadingWithCredentialsHandler()
    {
        mWebClient = <span style="color:blue;">new</span> <span style="color:#2b91af;">WebClient</span>();
    }

    <span style="color:blue;">public</span> <span style="color:#2b91af;">ResourceLoadingAction</span> ResourceLoading(<span style="color:#2b91af;">ResourceLoadingArgs</span> args)
    {
        <span style="color:blue;">if</span> (args.ResourceType == <span style="color:#2b91af;">ResourceType</span>.Image)
        {
            <span style="color:#2b91af;">Uri</span> uri = <span style="color:blue;">new</span> <span style="color:#2b91af;">Uri</span>(args.Uri);

            <span style="color:green;">// Download the bytes from the location referenced by the URI.</span>
            <span style="color:blue;">byte</span>[] imageBytes = mWebClient.DownloadData(args.Uri);

            args.SetData(imageBytes);

            <span style="color:blue;">return</span> <span style="color:#2b91af;">ResourceLoadingAction</span>.UserProvided;
        }
        <span style="color:blue;">else</span>
        {
            <span style="color:blue;">return</span> <span style="color:#2b91af;">ResourceLoadingAction</span>.Default;
        }
    }

    <span style="color:blue;">private</span> <span style="color:#2b91af;">WebClient</span> mWebClient;
}</pre></pre></div>

Hi,

Can you please share your input HTML document to reproduce the issue?

Best Regards,

Here is the html file.

Hi,

Sorry, I was not able to reproduce this issue at my end using the latest version of Aspose.Words (i.e. 15.6.0) and your code. Can you please confirm if you are using the latest version and URL passed to Document constructor returns a valid HTML?

Best Regards,