gmanny / Pechkin

.NET Wrapper for WkHtmlToPdf static DLL. Allows you to utilize full power of the library.
401 stars 128 forks source link

Nuget package exception #3

Open craigmckeachie opened 12 years ago

craigmckeachie commented 12 years ago

Thanks for your effort on this project.

I used the nuget package and received the following error after trying to to run a simple pechkin example (synchronized just hung) Unable to load DLL 'wkhtmltox0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I ran the latest installer for wkhtml and included the option to change my path (not sure I needed to do this) and tried again so success. Next I rebooted and everything worked (maybe the path is needed)

Note: I was doing this all from an ASP.NET MVC 3 project

I have everything running as desired and published it out to my shared hosting account (winhost) and I receive the following error.

Server Error in '/' Application.

Unable to load DLL 'wkhtmltox0.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.DllNotFoundException: Unable to load DLL 'wkhtmltox0.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

wkhtmltox0.dll IS in the bin folder and has read /write/ and execute permissions I'm concerned now that this will never work on shared hosting because wkhtml needs to be installed on the shared server. Is this correct? Here are a post that led me to believe this will be difficult. http://stackoverflow.com/questions/2273534/how-to-install-wkhtmltopdf-on-a-linux-based-web-server/3116571#3116571

UPDATE: I uninstalled wkhtml locally on my windows 7 machine and I worked with my hosting company and they fixed permission so now I get the following error both environments

Unable to load DLL 'wkhtmltox0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)


So the real question is should I need to install wkhtml or should it be enough to just have the dll included as it is in your NUGET package.

gmanny commented 12 years ago

Hello, I've identified the issue. It was that I didn't bundle proper dependencies in the package. So the answer to your question is it's enough to have the DLL included, just that there're four more of them.

I'm now uploading new version of the package and as soon as I'll verify that my theory is correct, I'll comment here.

gmanny commented 12 years ago

Yes, that fixed the issue. You can update package from NuGet and everything should be fine. Please, if issue has been fixd, leave a comment here.

craigmckeachie commented 12 years ago

Thanks for the quick response. I will test the change this evening and let you know.

On Tue, Aug 14, 2012 at 9:59 AM, gmanny notifications@github.com wrote:

Yes, that fixed the issue. You can update package from NuGet and everything should be fine. Please, if issue has been fixd, leave a comment here.

— Reply to this email directly or view it on GitHubhttps://github.com/gmanny/Pechkin/issues/3#issuecomment-7726538.

craigmckeachie commented 12 years ago

It now works locally without installing WkHtmlToPdfhttp://github.com/antialize/wkhtmltopdf on my development machine. Thank you.

On Tue, Aug 14, 2012 at 10:39 AM, Craig McKeachie <craigdmckeachie@gmail.com

wrote:

Thanks for the quick response. I will test the change this evening and let you know.

On Tue, Aug 14, 2012 at 9:59 AM, gmanny notifications@github.com wrote:

Yes, that fixed the issue. You can update package from NuGet and everything should be fine. Please, if issue has been fixd, leave a comment here.

— Reply to this email directly or view it on GitHubhttps://github.com/gmanny/Pechkin/issues/3#issuecomment-7726538.

gmanny commented 12 years ago

Thank you for your time!

craigmckeachie commented 12 years ago

Sorry to bother you again but I'm stuck with the same issue. Basically, I got the code working after uninstalling WkHtmlToPdf as mentioned above went on to other code for a few weeks and now the error has reappeared. Here is what I've tried so far. Uninstalling and Reinstalling the latest nuget package to be sure I have the latest. Stopping and starting the web development server several times. Reviewing our previous conversation and others on the site. To be more specific the current error I'm getting in a asp.net mvc application is: Unable to load DLL 'wkhtmltox0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.DllNotFoundException: Unable to load DLL 'wkhtmltox0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Source Error:

Line 81: Line 82: Line 83: byte[] pdfBuf = new SimplePechkin(new GlobalConfig()).Convert("basic html fragment");

As you can see from the stack trace I'm using SimplePechkin with just the most basic example provided.

I know I'm not supposed to be using SimplePechkin in a web app but when I run SyncronizedPechkin the application hangs and doesn't provide any exception details.

My current best guess is that maybe we are still missing a dependency and when I tested last after unistalling WkHtmlToPdf I still had not rebooted and had an environment variable hanging around...but that doesn't make sense because the dlls should have been gone at least. I appreciate any help.

gmanny commented 12 years ago

Okay, tell me what .dll's do you have added in the root of your project after installing nuget package?

craigmckeachie commented 12 years ago

Sure, here is the list: libeay32.dll libgcc_s_dw2-1.dll mingwm10.dll ssleay32.dll wkhtmltox0.dll

I also verified pechkin dlls are version 0.5.8.1

On Tue, Sep 4, 2012 at 3:41 PM, gmanny notifications@github.com wrote:

Okay, tell me what .dll's do you have added in the root of your project after installing nuget package?

— Reply to this email directly or view it on GitHubhttps://github.com/gmanny/Pechkin/issues/3#issuecomment-8275950.

craigmckeachie commented 12 years ago

Your question was enough of a hint for me to figure out what was wrong. These two dlls have properties set to content and copy always ssleay32.dll wkhtmltox0.dll The new dlls have properties set to content and never copy so they were not getting to the bin directory. I changed all the dlls to "copy always" and the simple example I had works again.

gmanny commented 12 years ago

That's strange, the script in nuget package should have set up all the libraries to copy. I'll check this, thank you.

mtangoo commented 9 years ago

Did you resolve it? I have same issue with latest nuget package

mtangoo commented 9 years ago

DLLs are not being copied into bin folder

jesperahlberg commented 8 years ago

Having the same issue as above, that wkhtmltox0.dll cannot be found. I'm using Pechkin 0.5.8.1 from nuGet, is there any other version that works better I should try? ASP .Net, C# web application here.

timhargan commented 6 years ago

This seems like an issue when using msbuild