LEADTOOLS Support
Document
Document SDK Examples
Invalid File Format when loading HTM HTML in a Console Application
#1
Posted
:
Wednesday, February 27, 2013 11:53:52 AM(UTC)
Groups: Registered, Tech Support
Posts: 207
Was thanked: 3 time(s) in 3 post(s)
This issue is due to the HTML filter not being thread safe. Rather the Microsoft object we use internally is not thread safe.
By default a Console Application's main function has the attribute [MTAThread] although it does not explicitly appear in the code.
To be able to load an HTML file from within a Console Application you must add the attribute [STAThread] to the function using the feature.
I have attached a sample Console Application that loads an HTML page from disk and saves it out as multi-paged TIFF.
Also, by default, the Microsoft object is using an HTML parser equivalent to I.E. 7. If you wish to support later versions of HTML (like HTML5) you will have to alter the registry setting for the object by adding your application's name and the version number of I.E. you wish to use. More information can be found here:
http://msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation
The attached project is in Visual Studio 2008 using LEADTOOLS Version 17.5
Travis Montgomery
Senior Sales Engineer
#2
Posted
:
Thursday, October 5, 2017 8:01:01 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Updated to LEADTOOLS v19 with Visual Studio 2017. Also changed project to automatically select dll's for running in 32-bit and 64-bit.
Extract to "C:\LEADTOOLS 19\Examples\DotNet\CS\" to use the example.
There is an included HTML file for testing ("CS_LoadHTMLConsole.htm"), copy to the LEADTOOLS Images folder ("C:\Users\Public\Documents\LEADTOOLS Images\") before running.
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Examples
Invalid File Format when loading HTM HTML in a Console Application
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.