DinkToPdf
DinkToPdf copied to clipboard
Unable to load DLL 'libwkhtmltox' in IIS windows 2012 R2
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.
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
Check my answer here on issue #76 It might be the issue you are facing.
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.
https://github.com/rdvojmoc/DinkToPdf/issues/76#issuecomment-518975970