0

I am using following link to capture web page as image Convert webpage to image from ASP.NET.

On few pages I am getting issue where the image created is not similar to actual page but its same as to page displayed in quirks mode(where the page is messed up). Is there any way to programmatically change the behavior of control(without making any registry changes)

Community
  • 1
  • 1
hampi2017
  • 701
  • 2
  • 13
  • 33
  • Looks like the only way to change `WebBrowser` rendering mode - except of changing registry - is to add *document compatibility* tags into HTML code of your pages. Please see updated answer. – Andrii Kalytiiuk Aug 05 '12 at 08:29

1 Answers1

0

According to post from official blog of Internet Explorer team the only two ways to change compatibility mode of WebBrowser control are:

  1. Add FEATURE_BROWSER_EMULATION key to the registry for your application
  2. Specify compatibility mode within HTML code of web page using !DOCTYPE and/or meta tags

Please note: Default mode of rendering pages by WebBrowser may depend on Internet Explorer version installed on machine, as it uses components of Internet Explorer. For IE8 by default WebBrowser renders pages in IE7 standards mode.

Part of your application's pages may fall back to older mode (quirks mode) due to crash of more modern render (which in fact can differ from one that is used when page is opened directly in IE) caused by some content on the page.

To resolve described problem you can alter HTML code of corrupt pages with DocumentText property of WebBrowser class in order to explicitly specify document compatibility that is appropriate for the pages (i.e. ensures proper rendering).

Andrii Kalytiiuk
  • 1,501
  • 14
  • 26