Unable to load DLL 'libwkhtmltox' or one of its dependencies

See original GitHub issue

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 image

I tried the both the both debug & release.

I’m stuck please help

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:17

github_iconTop GitHub Comments

13reactions
dgokhancommented, Jan 18, 2021

I solved this problem more quickly.

Solution: Add these codes inside the Project.Service.csproj

<ItemGroup>
  <None Remove="libwkhtmltox.dll" />
</ItemGroup>

<ItemGroup>
  <EmbeddedResource Include="libwkhtmltox.dll">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </EmbeddedResource>
</ItemGroup>
8reactions
JimWolffcommented, Mar 8, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DinkToPdf dll not found libwkhtmltox
DllNotFoundException: Unable to load DLL 'libwkhtmltox' or one of its dependencies: The specified module could not be found. (0x8007007E).
Read more >
Convert html to PDF Unable to load DLL 'wkhtmltox.dll'
1 - Open the custom SharePoint Project in your VS. 2- remove old references (.SharePoint.dll) (.sharepoint..dll) and add new references (.
Read more >
[Solved]-System.DllNotFoundException: 'Unable to load DLL ...
if you are running application in docker,then do an update to install libwkhtmltox dependencies for .netcore # install libwkhtmltox dependencies run apt-get ...
Read more >
C# – DinkToPdf Net Core not able to load DLL files
DllNotFoundException: Unable to load DLL 'C:\Program Files\IIS Express\libwkhtmltox.dll' or one of its dependencies: The specified module could not be found ...
Read more >
Net Core PDF Library from HTML (DinkToPdf) - Jannik Strelow
If you need an PDF library, wich converts an HTML document to a PDF ... (Unable to load DLL 'libwkhtmltox' or one of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found