DinkToPdf icon indicating copy to clipboard operation
DinkToPdf copied to clipboard

Unable to load DLL 'libwkhtmltox' in IIS windows 2012 R2

Open sasusi opened this issue 6 years ago • 4 comments

I am getting the below error, Unable to load DLL 'libwkhtmltox'. Given below are the configurations

Application is working fine with development server in IIS express. but while deployed in IIS(windows 2012 R2 - .net Core 2.0), application is throwing the above error in both scenarios.

1)libwkhtmltox(12.4) is copied in the root directory. 2)Even we have tried the option of loading the DLL from the LoadUnmanagedLibrary.. as well.

Please support.

sasusi avatar Jan 13 '19 05:01 sasusi

Have you set the properties of libwkhtmltox.dll to "Content" and "Copy if newer" / "Copy always" in visual studio?

Are you using (lib)wkhtmltox.dll with the correct bitness? Try using (lib)wkhtmltox.dll x86 if you have the x64 version - or vice versa.

You can specify the correct version to be used per configuration in csproj:

 <ItemGroup Condition="'$(Configuration)' == 'Debug'">
    <None Include="./lib/Wkhtmltopdf/wkhtmltox-x64.dll" Link="libwkhtmltox.dll" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>

  <ItemGroup Condition="'$(Configuration)' == 'Release'">
    <None Include="./lib/Wkhtmltopdf/wkhtmltox-x86.dll" Link="libwkhtmltox.dll" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

See the recipe where this is used: https://github.com/rdvojmoc/DinkToPdf/issues/70

Casimodo72 avatar Feb 07 '19 11:02 Casimodo72

Check my answer here on issue #76 It might be the issue you are facing.

JimWolff avatar Mar 08 '19 20:03 JimWolff

Hello, Check the answer from here.

https://stackoverflow.com/questions/55430532/dinktopdf-net-core-not-able-to-load-dll-files.

I used that and it worked very well.

githithu avatar Mar 30 '19 14:03 githithu

https://github.com/rdvojmoc/DinkToPdf/issues/76#issuecomment-518975970

olehspidey avatar Aug 07 '19 07:08 olehspidey