We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error with HtmlConverter class

Hi, I have downloaded source code provided for "WebPageToPDF" conversion. I am using .NET 2.0 for my project and I am facing problem with "HtmlConverter" class. As soon as my code reaches to "HtmlConverter" class, it gives me exception as below.. System.IO.FileNotFoundException was unhandled by user code Message="Could not load file or assembly ''''AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89'''' or one of its dependencies. The system cannot find the file specified." Source="Syncfusion.HtmlConverter.Base" FileName="AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" FusionLog="Assembly manager loaded from: C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\mscorwks.dll\rRunning under executable C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\WebDev.WebServer.EXE\r--- A detailed error log follows. \r=== Pre-bind state information ===\rLOG: User = MUMBAI\\ravikumar.katragadda\rLOG: DisplayName = AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89 (Fully-specified)\rLOG: Appbase = file:///C:/Inetpub/wwwroot/WebSite1/\rLOG: Initial PrivatePath = C:\\Inetpub\\wwwroot\\WebSite1\\bin\rCalling assembly : Syncfusion.HtmlConverter.Base, Version=4.202.0.31, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89.\r===\rLOG: This bind starts in default load context.\rLOG: Using application configuration file: C:\\Inetpub\\wwwroot\\WebSite1\\web.config\rLOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\rLOG: Post-policy reference: AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89\rLOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/website1/6746a9b5/a49de883/AxSHDocVw.DLL.\rLOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/website1/6746a9b5/a49de883/AxSHDocVw/AxSHDocVw.DLL.\rLOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebSite1/bin/AxSHDocVw.DLL.\rLOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebSite1/bin/AxSHDocVw/AxSHDocVw.DLL.\rLOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/website1/6746a9b5/a49de883/AxSHDocVw.EXE.\rLOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/website1/6746a9b5/a49de883/AxSHDocVw/AxSHDocVw.EXE.\rLOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebSite1/bin/AxSHDocVw.EXE.\rLOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/WebSite1/bin/AxSHDocVw/AxSHDocVw.EXE.\r" StackTrace: at Syncfusion.HtmlConverter.HtmlConverter..ctor() at HTMLImage.Convert() in c:\Inetpub\wwwroot\WebSite1\HTMLImage.aspx.cs:line 63 at HTMLImage.Button1_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\WebSite1\HTMLImage.aspx.cs:line 30 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) kindly suggest me what could be the problem and where i am doing wrong. thanks & regards, manoj singh.

11 Replies

AJ Ajish Syncfusion Team June 21, 2006 11:24 AM UTC

Hi Manoj, Thank you for your interest in Esssential PDF. The HTMLConverter uses the MSHTML rendering library to render HTML documents. The MSHTML library is the engine that is used to drive the Internet Explorer. It can he used in Asp.net environment. Here are some things that has to be done under Asp.net environment. 1) Add to the @Page directive AspCompat="true" attribute to the page where we want to perform html to pdf convertion. 2) Reference the "AxInterop.SHDocVw.dll" assembly to the project. Here is a sample for converting a webpage to PDF using Asp.net 2.0: ConvertWebPageToPDF Please take a look and let me know if you have any queries. Thanks, Ajish.


SE Sean October 21, 2006 07:07 PM UTC

I get the same error but when I try to reference AxInterop.SHDocVw.dll (copied from your example into the bin directory...I couldn't find this under "Add Reference..." in VS2005 on either the .NET or the COM tabs) I get a JIT Debugger error:

System.IO.FileNotFound in [temp project path]

Do I need a special using statement?


DK Dhivya K Syncfusion Team October 22, 2006 08:27 AM UTC

Hi Sean,

Thank you for our interest in Essential PDF.

You have to manually refer these assemblies by selecting "Browse" tab and locate the assemblies from bin folder. These assemblies cannot be found by default in public assemblies.Thats why you couldn't refer them through .Net tab.

Could you please refer these assemblies and add @Page directive AspCompat="true" and let me know if the problem still exist?

Here is a sample for your reference:
http://www.syncfusion.com/Support/user/uploads/ConvertToPDF_bfd9ccdf.zip

Please take a look into it and let me know if you have any questions.

Regards,
Dhivya.


AD Administrator Syncfusion Team October 22, 2006 04:35 PM UTC

I did add the references using Browse.... I debugged the app and checked the Fusion log where this was found:

"Assembly manager loaded from: C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\mscorwks.dll\rRunning under executable C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\aspnet_wp.exe\r--- A detailed error log follows. \r=== Pre-bind state information ===\rLOG: User = QUICKDRAW\\ASPNET\rLOG: DisplayName = AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89 (Fully-specified)\rLOG: Appbase = file:///c:/inetpub/wwwroot/aboda/\rLOG: Initial PrivatePath = c:\\inetpub\\wwwroot\\aboda\\bin\rCalling assembly : Syncfusion.HtmlConverter.Base, Version=4.302.0.30, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89.\r===\rLOG: This bind starts in default load context.\rLOG: Using application configuration file: c:\\inetpub\\wwwroot\\aboda\\web.config\rLOG: Using host configuration file: C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\aspnet.config\rLOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\rLOG: Post-policy reference: AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89\rLOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aboda/2e9aa854/224d7411/AxSHDocVw.DLL.\rLOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aboda/2e9aa854/224d7411/AxSHDocVw/AxSHDocVw.DLL.\rLOG: Attempting download of new URL file:///c:/inetpub/wwwroot/aboda/bin/AxSHDocVw.DLL.\rWRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN\rERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.\r"

I also tried using AxImp.exe to wrap these dlls. I copied c:\windows\system32\SHDocVw.dll to a folder and ran aximp.exe which produced a new SHDocVw.dll and AxSHDocVq.dll which I then put in the /bin directory and included references in the project. This did not work.

Thanks for your help


AD Administrator Syncfusion Team October 22, 2006 05:25 PM UTC

Also, I used FuseLogVw.exe and found the following log entry:

*** Assembly Binder Log Entry (10/22/2006 @ 10:26:46 AM) ***

The operation failed.
Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_wp.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = QUICKDRAW\ASPNET
LOG: DisplayName = AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89
(Fully-specified)
LOG: Appbase = file:///c:/inetpub/wwwroot/aboda/
LOG: Initial PrivatePath = c:\inetpub\wwwroot\aboda\bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\aboda\2e9aa854
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\aboda\2e9aa854
LOG: AppName = 224d7411
Calling assembly : Syncfusion.HtmlConverter.Base, Version=4.302.0.30, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\inetpub\wwwroot\aboda\web.config
LOG: Using host configuration file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aboda/2e9aa854/224d7411/AxSHDocVw.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aboda/2e9aa854/224d7411/AxSHDocVw/AxSHDocVw.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/aboda/bin/AxSHDocVw.DLL.
LOG: Assembly download was successful. Attempting setup of file: c:\inetpub\wwwroot\aboda\bin\AxSHDocVw.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: AxSHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Could this be a security issue where the assembly is expecting to be signed (hash encrypted)?



DK Dhivya K Syncfusion Team October 23, 2006 04:57 PM UTC

Hi Sean,

I am afraid. I am unable to reproduce the issue. Could you please remove the reference from web.config and re refer the assemblies from bin folder and let me know if the problem still exist?

Regards,
Dhivya.


PS Pon Saravanan April 2, 2008 12:29 AM UTC

Hi
i have downloaded the trial pack. And tried to compile the project. i received the reference not found for htmlconvertor.

then i downloaded the trial pack back office. and got the htmlconvertor. but now it is asking me to reference the 'System.Windows.Forms.UserControl'.

if i do that it breaks exactly at
HtmlConverter html = new HtmlConverter();

pelase advice

type 'System.Windows.Forms.UserControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.





AD Administrator Syncfusion Team May 10, 2009 09:07 PM UTC

Is there a solution to this problem?

I have the same problem, and have tried what is suggested in this thread without any results.

The type 'System.Windows.Forms.UserControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


AD Administrator Syncfusion Team May 11, 2009 12:46 PM UTC

Hi,

The HtmlConverter is the user control. So, while using the converter package we have to include the System.Windows.Forms.Usercontrol assembly reference in an application.

Please let us know if you need any other details.

Best Regards,
Bhuvana


BP Bhuvaneswari P Syncfusion Team May 11, 2009 12:46 PM UTC

Hi,

The HtmlConverter is the user control. So, while using the converter package we have to include the System.Windows.Forms.Usercontrol assembly reference in an application.

Please let us know if you need any other details.

Best Regards,
Bhuvana


AD Administrator Syncfusion Team May 12, 2009 10:56 AM UTC

That, of course, worked like a charm.

Thank you.

Loader.
Live Chat Icon For mobile
Up arrow icon