Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DinkToPdf Net Core not able to load DLL files

I am trying to generate PDFs from HTML SQL server database using DinkToPdf library.

In the startup file I have added:

var context = new CustomAssemblyLoadContext();
context.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll"));

The line gives me this error on launching the web app:

DllNotFoundException: Unable to load DLL 'C:\Program Files\IIS Express\libwkhtmltox.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(string unmanagedDllPath)

DllNotFoundException: Unable to load DLL 'C:\Program Files\IIS Express\libwkhtmltox.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

like image 346
Joseph Wambura Avatar asked Mar 30 '19 10:03

Joseph Wambura


1 Answers

Just in case anyone else is having the same issue I was able to solve it by installing Microsoft Visual C++ 2015 Redistributable.

like image 111
CAMILO OSPINA MOLANO Avatar answered Sep 28 '22 00:09

CAMILO OSPINA MOLANO