ExpertPdf Conversion error: WebKit Navigation timeout in GetPdfBytesFromUrl
<p>I am working on upgrading a .NET application without changing its functionality. What I did so far is:</p>

<ul>
<li>upgrading from mvc 2 to mvc 4</li>
<li>upgrading from framework 3.5 to 4.0</li>
<li>using visual studio 2015 instead of 2010</li>
<li>upgrading the custom made utilities and mvc the same way</li>
</ul>

<p>Right now I am stuck at the pdf conversion in the custom utilities dll. The error I get is in the image below. It says:</p>

<blockquote>
  <p>ExportHtmlToPdfBytes failed for url <a href="http://localhost:4984/Rijopdracht.mvc/Print/861175" rel="nofollow">http://localhost:4984/Rijopdracht.mvc/Print/861175</a>: Conversion error: WebKit Navigation timeout.</p>
</blockquote>

<p><a href="http://i.stack.imgur.com/VOiuF.jpg" rel="nofollow">Error message.</a></p>

<p>The link is available and accessible behind a proxy. The method ExportHtmlToPdfBytes looks like this:</p>

<pre><code>        public byte[] ExportHtmlToPdfBytes(string url)
    {
        try
        {
            PdfConverter pdfConverter = CreatePdfConvertor();

            byte[] bytes = pdfConverter.GetPdfBytesFromUrl(url);

            return bytes;
        }
        catch (Exception ex)
        {                
            throw new WrapperException(ex, "ExportHtmlToPdfBytes failed for url {0}:", url);
        }
    }
</code></pre>

<p>During debugging I discovered that the program breaks when it calls the function GetPdfBytesFromUrl. After the program breaks, the proxy user I use to access the url, gets blocked. I found out that a user gets blocked if and only if the password has been typed wrong 6 or more times. </p>

<p>I triple checked the username and password that came from the appsettings, and they are correct. Can somebody tell me what is going on and how to solve this?</p>

<p>The complete class PdfUtilities where this function comes from is:</p>

<pre><code>using ExpertPdf.HtmlToPdf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Jumbo.Utilities
{
    public class PdfUtilities
    {
        public PdfUtilities() {
            FooterText = String.Empty;
            FitWidth = false;
            LeftMargin = 5;
            RightMargin = 5;
            TopMargin = 5;
            BottomMargin = 5;
            PdfCompressionLevel = PdfCompressionLevel.Normal;
            JpegCompressionLevel = 10;
        }

        public string FooterText { get; set; }
        public string AuthenticationUsername { get; set; }
        public string AuthenticationPassword { get; set; }
        public bool FitWidth { get; set; }
        public string BaseUrl { get; set; }
        public int LeftMargin { get; set; }
        public int RightMargin { get; set; }
        public int TopMargin { get; set; }
        public int BottomMargin { get; set; }
        public int JpegCompressionLevel { get; set; }
        public PdfCompressionLevel PdfCompressionLevel { get; set; }

        private PdfConverter CreatePdfConvertor()
        {
            PdfConverter pdfConverter = new PdfConverter();

            pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
            pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel;
            pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Landscape;
            pdfConverter.PdfDocumentOptions.LiveUrlsEnabled = false;
            pdfConverter.PdfDocumentOptions.ShowHeader = true;
            pdfConverter.PdfDocumentOptions.ShowFooter = true;
            pdfConverter.PdfDocumentOptions.LeftMargin = LeftMargin;
            pdfConverter.PdfDocumentOptions.RightMargin = RightMargin;
            pdfConverter.PdfDocumentOptions.TopMargin = TopMargin;
            pdfConverter.PdfDocumentOptions.BottomMargin = BottomMargin;
            pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = true;
            pdfConverter.PdfDocumentOptions.EmbedFonts = true;
            pdfConverter.PdfDocumentOptions.JpegCompressionLevel = JpegCompressionLevel;


            if (FitWidth)
            {
                pdfConverter.PageWidth = 0;
                pdfConverter.PdfDocumentOptions.FitWidth = true;
                pdfConverter.PdfDocumentOptions.StretchToFit = true;
            }
            else
                pdfConverter.PdfDocumentOptions.FitWidth = false;

            //pdfConverter.PageWidth = 0;
            pdfConverter.PdfDocumentOptions.ShowHeader = false;

            pdfConverter.PdfFooterOptions.FooterTextColor = System.Drawing.Color.Black;
            pdfConverter.PdfFooterOptions.DrawFooterLine = false;
            pdfConverter.PdfFooterOptions.PageNumberText = "Page";
            pdfConverter.PdfFooterOptions.ShowPageNumber = true;
            pdfConverter.PdfFooterOptions.FooterText = FooterText;

            if (!string.IsNullOrEmpty(AuthenticationUsername) &amp;&amp; !string.IsNullOrEmpty(AuthenticationPassword))
            {
                pdfConverter.AuthenticationOptions.Username = AuthenticationUsername;
                pdfConverter.AuthenticationOptions.Password = AuthenticationPassword;
            }
            else
            {
                string username = SettingsUtilities.GetSetting&lt;string&gt;(GenericConstants.AS_PROXY_USERNAME, null);
                if (!String.IsNullOrEmpty(username))
                {
                    string password = SettingsUtilities.GetSetting&lt;string&gt;(GenericConstants.AS_PROXY_PASSWORD, null);
                    pdfConverter.AuthenticationOptions.Username = username;
                    pdfConverter.AuthenticationOptions.Password = password;
                }
            }

            pdfConverter.LicenseKey = "tZ6HlY2Vh4WBg5WDm4WVhoSbhIebjIyMjA==";

            return pdfConverter;
        }

        public byte[] ExportHtmlToPdfBytes(string url)
        {
            try
            {
                PdfConverter pdfConverter = CreatePdfConvertor();

                byte[] bytes = pdfConverter.GetPdfBytesFromUrl(url);

                return bytes;
            }
            catch (Exception ex)
            {                
                throw new WrapperException(ex, "ExportHtmlToPdfBytes failed for url {0}:", url);
            }
        }

        public byte[] ExportHtmlStringToPdfBytes(string html)
        {
            PdfConverter pdfConverter = CreatePdfConvertor();

            byte[] bytes;
            if (BaseUrl == null)
                bytes = pdfConverter.GetPdfBytesFromHtmlString(html);
            else
                bytes = pdfConverter.GetPdfBytesFromHtmlString(html, BaseUrl);

            return bytes;
        }

        public void SaveHtmlToPdf(string url, string saveLocation)
        {
            Logging.LogVerboseCaller(Logging.Cat.Utilities, "Start export to htm for " + url);
            byte[] contents = ExportHtmlToPdfBytes(url);
            Logging.LogVerboseCaller(Logging.Cat.Utilities, "End export. Start save to " + saveLocation);
            FileUtilities.SaveFile(saveLocation, contents);
            Logging.LogVerboseCaller(Logging.Cat.Utilities, "End save");
        }
    }
}
</code></pre>