Type Default Value Read Only Description

[Visual Basic]
MSHtml No The engine to use for HTML import operations.




This property specifies the HTML engine to use when importing HTML pages.

The EngineType enumeration can take any of the following values:

  • MSHtml. Characteristics:
    • The Screen style sheets are used during the rendering process.
    • Page heights can vary across different pages. Segments of the HTML document are composed dynamically to fit the target rectangle as accurately as possible during each call to Doc.AddImageToChain. This means the target rectangle will be filled with more contents for larger target rectangles instead of scaled to fit.
    • For definite control of HTTP requests, you should set TransferModule to a non-default value.

    Internet Explorer 9 support

    ABCpdf automatically detects and accommodates the architectural changes introduced in Microsoft Internet Explorer 9. For many server applications, this is transparent and and requires no code change.

    The Fusion Log Viewer is known to interfere with the initialization of the MSHtml engine. If any problem arises, try disabling it or specify a local custom log path.

    Currently, there are some limitations when using the MSHtml engine hosted out-of-process (See MSHtmlBootstrap):

  • Gecko. Characteristics:
    • The Gecko engine is a component independent of other parts of the Operating System. It will not be affected even if you upgrade your Internet Explorer or another local Firefox installation.
    • It supports a wide range of the HTML5 and CSS3 standards.
    • It supports the majority of the SVG Full profile. SVG graphics embedded inside Web pages convert natively to PDF primitives. Alternatively, you can specify the a SVG file's location in Doc.AddImageUrl or provide a string of SVG contents to Doc.AddImageHtml to have it converted to PDF using the Gecko engine.
    • It supports XML pages with XSLT and MathML.
    • You can specify which set of style sheets to use (Print/Screen) through the use of the Media property.
    • In large tables that span across pages, thead and tfoot elements are repeated across different pages properly.
    • The rendered HTML will always fill the entire current rectangle. After the initial call to Doc.AddImageUrl or Doc.AddImageHtml, the page height will be fixed at that point. Subsequent pages rendered using Doc.AddImageToChain will be automatically scaled (instead of having the contents reflowed) to fit in the current rectangle as much as possible.
    • ActiveX components are not supported.
    • The Paged property is always assumed to be true.
    • The Gecko engine does not use Page caching. This means that your rendered PDF is never stored in a memory cache.
    • On the other hand, Web caching is used to store contents downloaded over the Internet and is configurable using with the UseNoCache property.
    • JavaScript in OnLoadScript cannot directly modify the document object. For example, document.write("hello world"); would not work. Most of the time, you can work around to get your desired effect by indirectly modifying elements on the page, such as document.body.innerHTML = "hello world";
    • The use of OnLoadScript does not require UseScript. You are free to use JavaScript to customize the page without allowing JavaScript execution in the HTML.

    Gecko configuration

    The Gecko engine contains a number of preferences that can be configured. There are a set of .js files in the "XULRunner??_?\defaults\pref" folder that are loaded in alphabetical order when it starts. Each file contains a set of preferences. So by adding your own .js file to this folder, you can add in your own settings.

    If you are not familiar with the format of these files, you may find it easier to copy a configuration file from Firefox:

    • View the URI "about:config" in Firefox.
    • Modify the configuration as usual.
    • Close Firefox. The configuration is saved to the file only when Firefox is completely closed.
    • See the Path value in %APPDATA\Mozilla\Firefox\profile.ini. For example, the value may be Profiles/sx4fgjw2.default.
    • Copy prefs.js in the folder pointed to by the Path value (relative to the path of profile.ini) to:
      • XULRunner??_?\defaults\pref. The preferences are considered to be set by the software developer. For example, copy C:\Users\<user>\AppData\Roaming\Mozilla\Firefox\Profiles\sx4fgjw2.default\prefs.js to XULRunner??_?\defaults\pref.
      • some place outside of XULRunner??_? and set the file path (including the file name) to the GeckoPrefFile registry value. The preferences are considered to be set by the end user. See below for the differences between preferences set by the end user and those set by the software developer.
    • Do not delete or change the first line in prefs.js. You need only the lines relevant for your configuration change. You can delete other irrelevant lines.

    Preferences set by the end user are in the JavaScript file whose path is assigned to the GeckoPrefFile registry value. (Registry values can alternatively be specified in web.config or app.config.) The file is loaded after all JavaScript files in "XULRunner??_?\defaults\pref", so user-set preferences take precedence. Some preferences are in effect only when set by the end user. Here is an incomplete list of such preferences:

    Preference in effect only if it is set by the end user Default Value Description
    intl.accept_languages "en-US, en" The order of languages of the fonts to search when the specified font does not support a character. The Gecko engine appends to the list the ones that are missing in the following in order ja, ko, zh-CN, zh-HK, zh-TW. For example, without specifying this preference, a piece of simplified Chinese text (in a Latin font) may be imported in multiple fonts because some characters are supported by Japanese fonts and some are not.

    Additional supported settings:

    Preference Default Value
    print.print_shrink_to_fit true
    print.print_scaling "1"

Each HTML engine supports a different subset of HtmlOptions methods and properties. You can use one of the filter objects: ForMSHtml and ForGecko, to filter the supported options in your IDE.