You can't do it this way. The load will not finish unless you are running a message pump. You would typically use a thread runner to resolve this issue:
https://www.essentialobjects.com/doc/webbrowser/start/webview_no_ui.aspxAdditionally, it's very likely that your resize and capture will fail on a size of 5000 * 4000. For performance reason, internally the browser engine uses hardware acceleration surface support provided by the video card/driver to compose the final output whenever it can. Since the primary purpose of such composition is for screen output, the GPU hardware and drivers usually do not maintain buffers that are significantly larger than a normal screen size, which means resizing the browser window to this size can often fail.
In your case, you can try to use this overload of Capture to capture the screen:
https://www.essentialobjects.com/doc/eo.webbrowser.webview.capture_overload_1.aspxThere are two key points about this function:
1. The captured area does not have to be the same as the screen area. This means you do NOT need to resize the WebView to cover the entire area you want to capture. The capture area is specified by the first argument of this method. The WebView size is not directly related to the capture area --- however it can affect the layout of the page. For example, if you have text that automatically wrap to the next line, then obviously a narrower window will produce more text lines;
2. The final image size is specified in the second argument. Typically this size can be used to scale down the size of the final image to avoid buffer allocation failure. For example, you can specify the capture area to be 5000 by 4000 but the final image size to be 500 by 400. This will significantly reduce the output image size thus make the call more likely to succeed. If you wish to have high resolution output, then you have two options:
a. Capture a smaller area. This is due to the same memory restrictions (not directly related to how much memory your system has but more to internal implementation of your GPU hardware/driver);
b. Use our HTML to PDF feature to render the page to PDF. PDF is rendered in vector format instead of bitmap. So it can maintain high quality and reasonable size at the same time (this is exactly why PDF is so popular). This option might work better for your purpose because PDF usually offers the best viewing quality since you can zoom in without losing quality;
Hope this helps. Please feel free to let us know if you still have any questions.
Thanks!