I'm trying to render a html code to export it to an image and then use that image to put it in a pdf document. I'm doing all in an asp.net/C# web application. The problem I'm having is that when I do that more than one time it give me this error:
You are attempting to re-initialize the WebCore. The WebCore must only be initialized once per process and must be shut down only when the process exits.
This is my code:
WebCore.Initialize(new WebConfig(), false);
using (WebView webView = WebCore.CreateWebView(pageWidth, pageHeight))
while (webView.IsLoading || !webView.IsDocumentReady)
string fileName = Server.MapPath("result.png");
BitmapSurface surface = (BitmapSurface)webView.Surface;
I figure that I can't initialize the WebCore every time the web page render, so I put it in the Global.asax. After doing this, when I'm debugging, another error came up:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The current thread is not currently running code or the call stack could not be obtained.
Any ideas how can I do this?