I have a timeout problem with HtmlToPdf.ConvertUrl
After starting a new website I call:
Code: C#
HtmlToPdf.ConvertUrl(myURL, memoryStream, htmlOptions);
HtmlToPdf.ClearResult(); // This seems to have no effect
myURL points to a page with a lot of javascript rendering an ArcGIS map.
First time the operation goes fine - I get a great PDF after about 20 sec. (It's quite slow considering it takes about 3-4 sec in the browser - but it works.) After that I can use the website, call any URL and use the website normally. I can use functions that generate PDF using the same code - rendering Html with little or no javascript. I can call the URL of the "myURL" ArcGIS map that i just rendered and it works. I get the same result in the browser as in the PDF.
BUT - if I call HtmlToPdf.ConvertUrl a second time on the complex page (or another page that contains the same JavaScript map) - the whole website process locks up, no PDF i rendered. Eventally I get an exception:
"An unhandled exception of type 'System.Exception' occurred in EO.Pdf.dll
Additional information: System.Exception: Times out while loading Url or HTML. Please try to increase HtmlToPdfOptions.MaxWaitTime."
But even with a try-catch block handling the error - the website is dead. I've tries to split the rendering into a different Thread to protect the main thread:
Code: C#
Thread t = new Thread(renderingThread.start);
t.Start();
But the result is exactly the same. Only a stop-start of the website works. After a restart I can again render any pdf I want, with or without an ArcGIS map. But only once - after that, any subsequent call-to-render of an URL with an ArcGIS map will crash the website.
I can, of course, call "myURL" in the browser without error. The website only crashes what myURL is called through ConvertUrl() a second time.
It's like HtmlToPdf goes into a state that only a complete process-restart can resolve. But since the HtmlToPdf object can't be destroyed/reset any other way the whole website must be restarted. (ClearResult() has no effect.)
Any ideas will be much appreciated.