DinkToPdf: Unable to load DLL 'libwkhtmltox' or one of its dependencies
Request ID: System.AggregateException: One or more errors occurred. (Unable to load DLL ‘libwkhtmltox’ or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)) —> System.DllNotFoundException: Unable to load DLL ‘libwkhtmltox’ or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at DinkToPdf.WkHtmlToXBindings.wkhtmltopdf_init(Int32 useGraphics)
at DinkToPdf.PdfTools.Load()
at DinkToPdf.BasicConverter.Convert(IDocument document)
at DinkToPdf.SynchronizedConverter.<>n__0(IDocument document)
at DinkToPdf.SynchronizedConverter.<>c__DisplayClass5_0.<Convert>b__0()
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of inner exception stack trace --- at DinkToPdf.SynchronizedConverter.Invoke[TResult](Func1 delegate)
at DinkToPdf.SynchronizedConverter.Convert(IDocument document)
at GymCore.Controllers.RegistrationController.CreatePDF(Int32 regno) in C:\Users\UDN002\Desktop\GymCore\GymCore\Controllers\RegistrationController.cs:line 489
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at System.Threading.Tasks.ValueTask1.get_Result() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context) ---> (Inner Exception #0) System.DllNotFoundException: Unable to load DLL 'libwkhtmltox' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E) at DinkToPdf.WkHtmlToXBindings.wkhtmltopdf_init(Int32 useGraphics) at DinkToPdf.PdfTools.Load() at DinkToPdf.BasicConverter.Convert(IDocument document) at DinkToPdf.SynchronizedConverter.<>n__0(IDocument document) at DinkToPdf.SynchronizedConverter.<>c__DisplayClass5_0.<Convert>b__0() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
— End of stack trace from previous location where exception was thrown —
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)<—
Still facing the issue can you please help :
I have set the properties of libwkhtmltox.dll

I tried the both the both debug & release.
I’m stuck please help
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 17
I solved this problem more quickly.
Solution: Add these codes inside the Project.Service.csproj
What you might be experiencing could be a misleading error message, if you don’t have the VSRedist 2015 package installed on the machine/server. (typical for use of c++ libraries)
You could try using my powershell module to detect/silently install the redistributable package: PowershellVsRedistInstaller
You can also just check the powershell code to find where to check in the registry or check where to download the files.
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.
Having this issue on an azure function. Has anyone gotten this to work in an azure function?

I have lost a number of hours trying to resolve this issue on OSX and have finally found the solution which is quite obvious in hindsight. Hopefully it helps someone in the future.
Windows reference - libwkhtmltox.dll OSX reference - libwkhtmltox.dylib Linux reference - libwkhtmltox.os
Obviously make you you reference the correct file for your OS.
https://githubmemory.com/repo/rdvojmoc/DinkToPdf/issues/100
I needed to solve this without installing any packages. I managed to solve it by downloading all 3 files (dll, dylib and so) and putting them into the project directory. Then I added this into the .csproj file:
<ItemGroup> <None Update="libwkhtmltox.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> </None> <None Update="libwkhtmltox.dylib"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> </None> <None Update="libwkhtmltox.so"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> </None> </ItemGroup>It’s worked. Thanks bro
download this on server, where you try to use libwkhtmltox.dll https://support.microsoft.com/ru-ru/help/2977003/the-latest-supported-visual-c-downloads